First EA Version1 Near Completion- Need Help
Page 1 of 615 123 ... LastLast
Results 1 to 10 of 41

Thread: First EA Version1 Near Completion- Need Help

  1. #1
    Any developers able to have quick look at my post to help me include error handling and also to make certain ticket recognition is correct, etc..

    Https://www.nigeriaforextrading.com/...g-journal.html

    I shall come here and post it after I have it completed, which should only take a few minutes for an experienced programmer to critique it and tidy it up so that it matches best practices

  2. #2
    I havn't had a chance to look at your code but the errors are because of this :

    131 error : is an Invalid commerce volume so that you need to ensure this value isn't smaller or bigger than your broker allows.

    4051 mistake :is an Invalid function parameter value , assess your functions (likely the custom ones you have written) and make sure they have the correct parameter values. . .parenthesis, values inside the parenthesis , etc..

  3. #3
    Thanks... I think I fixed that issue today... but today it is not following the principles and opening multiple orders each line

    I inadvertently had this on three charts on my demo, and it opened up lots of orders.... Pleasant to create 10% on 10k demo account in minutes, but not how it was intended to work :--RRB-

    What do I want to do in order to get just 1 line each transaction? .... Re-attaching and including indiors also


    Edit:
    Fixed the multiple openings.... Error for line2 code.... Now egy tester is simply opening 4 lines (all wins, minimal drawdown that's the purpose of this EA).... Anyway, when the t/p strikes, it is not resetting that line to 0 today, thus not opening more transactions... re-attaching most upgraded EA version
    https://www.nigeriaforextrading.com/...0535111063.mq4
    https://www.nigeriaforextrading.com/...1923463858.mq4
    https://www.nigeriaforextrading.com/...1005853592.mq4

  4. #4
    I see what it is doing today....

    These two things need correction:
    #1 Reset the lineorders to 0 if TP occurs (right now it quits after one commerce)
    #2 There is a bug in it that it is opening all four orders in the same time rather than following the principles.... It should only open orders on line crosses with appropriate setup.... I think that has something to do with having to count bars or something, but I am not sure

  5. #5
    Nothing related to your problem at hand but I believe you want to relook your own CloseMarketOrders() function because logically... I don't think it'll get the job done.

    Recall the positional index of the trades on your commerce pool is similar to an array index with the initial position starting from 0. Say you've got 10 orders. Their position index will be from 0 to 9.

    OrdersTotal() provides you with a number 10 since there are in fact 10 trades on your commerce pool. But if you throw that number straight into OrderSelect, it's going to tell you there is no such order or array out of bound exception rather deal. Even by some off chance it continues, you've got your while (cntgt;0) in the manner. That means if there is only 1 order or left with 1 order, which will be at position 0, it won't be processed. As it doesn't fit on your condition. So... guideline when it comes to looping backwards, use these instead.
    Inserted Code cnt = OrdersTotal() - 1; while (cnt gt;= 0) // blah blah blah... cnt--;
    alternatively you can just use a for loop which is what I favor.

    Inserted Code int numberOfOrders = OrdersTotal(); if (numberOfOrders gt; 0) for (int cnt=numberOfOrders-1; cnt gt;= 0; cnt--) // blah blah blah...
    regards,
    Zen

  6. #6
    You can tackle ur #1 by using this purpose

    Inserted Code void CheckAndReset() if (line1ticket gt; 0) if(! OrderSelect(line1ticket, SELECT_BY_TICKET, MODE_TRADES)) line1ticket = 0; line1trades = 0; if (line1ticket gt; 0) if(! OrderSelect(line2ticket, SELECT_BY_TICKET, MODE_TRADES)) line2ticket = 0; line2trades = 0; if (line3ticket gt; 0) if(! OrderSelect(line3ticket, SELECT_BY_TICKET, MODE_TRADES)) line3ticket = 0; line3trades = 0; if (line4ticket gt; 0) if(! OrderSelect(line4ticket, SELECT_BY_TICKET, MODE_TRADES)) line4ticket = 0; line4trades = 0;
    regards,
    Zen

    p.s., just a notion, this purpose would've been 1/4 its current size if you had used arrays to store and manage the lineup#ticket and lineup#trades values.

  7. #7
    Ok, this is the update....

    Once I use the for loop, it's continually giving mistake 138 messages without any orders open

    The buy orders was functioning correct (not opening all of 4 at same time) but it's not resetting line orders in TP

    The market orders was opening all 4 at precisely the exact same time.... So I copied the buy logic and reset it all to sell logic to find out if this would fix the issue

    Additionally, why is not tp random? It is always the lowertakeprofit amount rather than a random number between both ranges
    https://www.nigeriaforextrading.com/...5811958515.mq4

  8. #8
    Quote Originally Posted by ;
    Ok, this is the update....

    When I use the for loop, it is continually giving mistake 138 messages without any orders available
    I have amended the code in my post above. Check it.

  9. #9
    And can you devote some time tidying up your codes with appropriate indentations. Codes in the block must align. Cubes within another block ought to indent. Your codes aren't the worse I have read but there is definitely room for improvement when it comes to readability.

    You can use the indior I posted as a manual.

    regards,
    Zen

  10. #10
    Ok, ammended the code

    so far as the arrays, can you provide me an sample of what you are speaking about?
    https://www.nigeriaforextrading.com/...1064511965.mq4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.