Programming Questions

thread: Programming Questions

  1. #1

    Programming Questions

    I know a code in simpler syntax and I am new to the Forex (about a month)

    I am attempting to make adjustments to an EA and thus going line by line to comprehend that the Forex logic (and syntax) with certain segments... this is a section that I'm trying to understand as I wish to ensure that the code does not open orders on Friday, however if transactions are still open going into Friday to allow it to manage them without closing them

    Thanks so much for your help!
    =========================

    Variables:

    int OpenOrders=0, cnt=0;
    extern bool TradeOnFriday=False;
    int OrdersTimeAlive=0; // in moments
    bool ContinueOpening=True;
    datetime LastOrderOpenTime=0;

    ================================
    Code Block:

    // should dont trade fridays then we shut all
    if (! TradeOnFriday DayOfWeek()==5)

    PreviousOpenOrders=OpenOrders 1;
    ContinueOpening=False;
    text = text\nClosing all orders and stop trading since TradeOnFriday protection.;
    Print(Closing all orders and stop trading since TradeOnFriday protection.) ;


    // Orders Time living protection
    if (OrdersTimeAlivegt;0 CurTime() - LastOrderOpenTimegt;OrdersTimeAlive)

    PreviousOpenOrders=OpenOrders 1;
    ContinueOpening=False;
    text = text \nClosing all orders since OrdersTimeAlive protection.;
    Printing(Closing all orders since OrdersTimeAlive protection.) ;


    ======================================

  2. #2
    Also, what is the aim of void here?

    ====================================

    void DeleteAllObjects()

    int obj_total=ObjectsTotal();
    string name;
    for(int I=0;ilt;obj_total;I )

    title=ObjectName(I);
    if (title! =-RRB-
    ObjectDelete(title);

    ObjectDelete(FLP_txt);
    ObjectDelete(P_txt);

  3. #3
    Are there any developers that can spend 10-15 minutes on a chat with me so I can edit an EA, personally to give me direction?

    I discovered a function for broker digits... there is a set of templates with this EA that also requires the broker multiplying ratio for this, but I do not know how to call that into a template document since the .tpl file appears like it is all text and it is not doing any function work

  4. #4
    I changed this:

    OrderSend(Symbol(),OP_SELL,mylotsi,SellPrice,slipp age,sl,tp,MyMEFx EA MagicNumber,MagicNumber,0,ArrowsColor);
    return(0);

    To:

    int ticket = OrderSend(Symbol(),OP_SELL,mylotsi,SellPrice,slipp age,0,0,MyMEFx EA MagicNumber,MagicNumber,0,ArrowsColor);
    Sleep(1500);
    OrderModify(ticket,OrderOpenPrice() ,sl,tp,0,ArrowsColor);

    =========================================

    I'm getting these errors:

    2009.02.28 17:32:59 2009.01.01 20:42 EATest AUDJPY,H1: Ranked ticket for OrderModify function
    2009.02.28 17:32:59 2009.01.01 20:42 EATest AUDJPY,H1: OrderSend Mistake 131
    2009.02.28 17:32:59 2009.01.01 20:42 EATest AUDJPY,H1: OrderModify Mistake 4051

  5. #5
    Junior Member Merjttipk's Avatar
    26
    Here is a listing of runtime errors in MQL4.

    Http://docs.mql4.com/runtime/errors

    You can do an internet search on the MQL4 posts, codebase or forum, you're likely going to find out answers to your question.

  6. #6
    Also, what is the purpose of void here?

    ====================================

    void DeleteAllObjects()

    int obj_total=ObjectsTotal();
    string name;
    for(int I=0;ilt;obj_total;I )

    name=ObjectName(I);
    if (name! =-RRB-
    ObjectDelete(name);

    ObjectDelete(FLP_txt);
    ObjectDelete(P_txt);
    emptiness indies that the function returns no information. This can be void, int, double, bool such as it depends on what type of information is returned.

  7. #7
    I understand a code in easier syntax and I am new to the Forex (about a month)

    I am trying to make revisions to an EA and thus going line by line to understand the Forex logic (and syntax) with specific sections... this is a section that I'm attempting to understand as I wish to make sure that the code doesn't open orders on Friday, however if trades are still open going into Friday to allow it to handle them without closing them

    Thanks so much for your help!
    =========================

    Variables:

    int...
    Better to use TimeDayOfWeek instead if you plan on running the EA throughout the egy tester. Dayofweek will return the current day of the week at the egy tester.

  8. #8
    Well, as a result of Ronald, I was able to fix the Market Execution now I know how to get it done with all EAs Where can the print work print to? I am getting SendError 131 which is a lot size problem related to my broker.... If I place it to print lot size, where is that information going to? I am acquainted with msgbox work on vba once I want to see a factor value pop up during implementation Right now, this EA is closing everything on Friday.... I will work to fix that following... why would you indie the change from DayofWeek==5 to TimeDayofWeek==5? Can you describe the logic behind it? Right now it is checking to see if it is Friday and closing all trades... when I do the edit, I'll want it to check to Find out if it is Friday and not open any new ones, and Perhaps certain rules on How Best to manage Those That are still open entering Friday

  •