Should be an easy problem for an experienced programmer :)

thread: Should be an easy problem for an experienced programmer :)

  1. #1
    Junior Member Emilio1616's Avatar
    25

    Should be an easy problem for an experienced programmer :)

    Hey! I am running multiple EAs on multiple time frames , I've coded these EAs myself... I've coded these EAs to only enter one trade at some time... But as soon as this trade has closed , I want It to put in a different trade if paramenters are nevertheless correct , so how can you tell the EA the trade which has been entered has shut ? You cant use the TotalOrders() work because that interferes with my other EAs and their trades.

    So will you please help me to somehow code my EA to understand when the trade it entered has shut and must reinitialise its parameters and then place the overall trades back to 0 ....


    I am also getting the error : Memory handler : can't devote 630892 bytes of memory ...

    any idea how I could clear the memory my EA uses now and then and re-load it... I really do have sufficient physical memory as I've 16GB gambling RAM in my computer and 40GB virtual RAM so that I dont think Its realy the memory thats operating out... any ideas , has anybody noticed this before?

    Thanks so much !

    Heres the code :
    Code :
    // ------------------------------------------------------------------
    //| Xlr8eSoft Probability Trader.mq4 |
    //| Copyright © 2010, MetaQuotes Software Corp.. |
    //| http://www.metaquotes.net/ |
    // ------------------------------------------------------------------
    #property copyright
    #property link http://www.metaquotes.net/
    // ------------------------------------------------------------------
    //| pro initialization function |
    // ------------------------------------------------------------------
    extern int Total_Orders_EA = 1;
    extern int Open_Percentage = 80 ;
    extern int Close_Percentage = 40 ;
    extern int Take_Profit = 13 ;
    extern int Stop_Loss = 15 ;
    int PMI ;
    series TI ;
    int buy ;
    int sell ;
    extern int Max_Order_Count = 5;
    extern dual Slippage = 3;
    extern int Magic_Number = 10810 ;
    extern double Lots = 0.05 ;
    int Complete = 0;

    int init()

    //--


    int Complete = 0;


    //--
    return(0);



    int start()

    //-


    iCustom(NULL, 0, MEGATREND PROBABILITY METER II,13,7,0) ;




    Printing(GetLastError());
    series Probability_Value = ObjectDescription(prop_value);


    PMI = StrToDouble(StringSubstr(Probability_Value,0,Strin gLen(Probability_Value)-1));


    TI = ObjectDescription(trend_comment_);
    Printing (Succesful no 4.5);
    buy = StringFind(TI,LONG,0);
    sell = StringFind(TI,SHORT,0);



    Printing(BUYSELL,buy, sell);


    Printing(PMI,Probability_Value);






    if(Total_Orders_EA gt; Total)



    Printing(GetLastError());
    if(PMI gt; Open_Percentage buy ! = -1)




    OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask - Stop_Loss * Point,Ask Take_Profit * Point,Xlr8eBot,0,0,Green);
    Complete ;











    if(Total_Orders_EA gt; Total)

    if(PMI gt; Open_Percentage sell ! = -1)


    OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Bid Stop_Loss * Point,Ask - Take_Profit * Point,Xlr8eBot,0,0,Red);


    Complete ;





    //--
    return(0);


    // ------------------------------------------------------------------

  2. #2
    Member
    70
    Int TradeCount = 0;
    for(int T = OrdersTotal(); T gt;= 0; T--)

    OrderSelect(T, SELECT_BY_POS, MODE_TRADES);
    if(OrderMagicNumber() == MagicNumber [Other trade qualifying standards]) TradeCount ;



    There, which wasn't really challenging.

  3. #3
    Junior Member Emilio1616's Avatar
    25
    Lol like I said developers thanks a lot! Will check it out!

  4. #4
    Junior Member Emilio1616's Avatar
    25
    int TradeCount = 0;
    for(int T = OrdersTotal(); T gt;= 0; T--)

    OrderSelect(T, SELECT_BY_POS, MODE_TRADES);
    if(OrderMagicNumber() == MagicNumber [Other trade qualifying standards]) TradeCount ;



    There, that wasn't so challenging.
    Im just worried becuase how can I get the trade count back to 0 for the entire cycle to start again... ?

  5. #5
    Im only concerned becuase how can I get the trade count back to 0 for the entire cycle to start again... ?
    MetaTrader it's a 32 bit appliion. It can only use 2 GB of your 16 GB of RAM. There is no way around this.

  6. #6
    Member
    70
    Im only worried becuase how do I get the trade count back to 0 for the entire cycle to begin again... ?
    It is always reset to 0 whenever the for loop begins

  •