OrderModify() question - page 6

 

Whoodoo,

Since nothing seems to penetrate your skull somehow, I'll help the kind moderators here spell things out for you.

I fixed your code to show you several points:

  • Your code is sloppy and convoluted just to achieve a simple algorithm objective. The messy & redundant use of curly parentheses was pointed out and it shows the messy state of your head.
  • Instead of reading the MQL4 manual thoroughly, follow through the first EA tutorial, and then unit testing Order*() functions, you would rather waste time and have other people spoonfed you about the things you ignore.
  • If you maintain this approach, it is best that you are aware of the very long path ahead to actually be able to use MQL4. Ironically it is not because MQL4's complexity (it is relatively simple), but it is because of the attitude you are strangely supporting.
Good luck and may God have mercy on your soul.
 

Richard, your incite has been noted. Thank you for your revision of volume I and your post. Both are appreciated.

Thank you.

 

Simon,

Code is checking OrderSelect() function AND if OrderSymbol() function is USDJPY. If both are true, then OrderPrint() function is executed. OrderSelect() is going to be fine, but ;) if OrderSymbol() isn't USDJPY, then the ticket variable i is increased by 1. Variable i is increased until OrderSymbol() is USDJPY.

Question: Why is the "i++;" increasing i's value one time only? (My intention is for this variable to continue increasing until OrderSymbol() is USDJPY)

int start()
  {
   
   int i;

   if((OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)&&(OrderSymbol()=="USDJPY"))
   
     OrderPrint();      
     
     else i++;
   
 // Print(GetLastError());
 
Comment("i = " ,i);

   return(0);
  }

The file attached is an EA. I find it easier to run tests with this file type.

Thank you.

Files:
Reason: