??????????
Question does not fit the code shown.
if ( iClose(NULL,0,23)>iClose(NULL,0,12) ) then integer =1
Then:
if ( iClose(NULL,0,2)< iClose(NULL,0,1)) res=OP_BUY;
if ( iClose(NULL,0,2)> iClose(NULL,0,1) res=OP_SELL;
OR
if ( iClose(NULL,0,23)<iClose(NULL,0,12) ) then integer =2
Then:
if ( iClose(NULL,0,3)< iClose(NULL,0,2)) res=OP_BUY;
if ( iClose(NULL,0,3)> iClose(NULL,0,2) res=OP_SELL;
//+------------------------------------------------------------------+ //| function of issuing trade siglnal | //+------------------------------------------------------------------+ int yourFunction() { int res ; if ( iClose(NULL,0,23)>iClose(NULL,0,12) ) {//True if ( iClose(NULL,0,2) < iClose(NULL,0,1) ) res=OP_BUY; else res=OP_SELL; } else {//False if ( iClose(NULL,0,3) < iClose(NULL,0,2) ) res=OP_BUY; else res=OP_SELL; } return (res); }
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I try to do a random choice between two values, as shown below. The problem is that sometimes the value is not updated timely and the new value instead of using new uses old and new open order is wrong. Interestingly, then is updated, but it is too late. Where could be a problem? I trade on offline chart with no problem, but may be something is wrong?