alexcorvis:
Dear MQ4 Coder
Kindly need your help
Trying many time with difference approaching, develop my EA with condition: 1 buy and sell in a cycle of trend, but so far getting failed.
My EA Logic:
1. First time activate the EA, EA will OP BUY and SELL based on signal.
2. After order closed by hit TP or SL, and Signal still goes on EA will not take any position until the opposite signal appears.
Herewith my code, but still not working:
Million Thanks and sorry for my poor English
Alex | Indonesia
Maybe you should change the code a little bit like this:
int last_trade = OrdersHistoryTotal() - 1;
Everything else remains the same...
if(OrderSelect(last_trade-1,SELECT_BY_POS,MODE_HISTORY)==true) { if((OrderType()==OP_SELL) && (SIGNAL=="SELL")) return(0); //... } // At this point you can use just an else else {// if(OrderSelect(last_trade-1,SELECT_BY_POS,MODE_HISTORY)==false) /* if orderSelect failed then OrderType is not valid. * if((OrderType()==OP_BUY) ... */
WHRoeder:
let me try
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
Dear MQ4 Coder
Kindly need your help
Trying many time with difference approaching, develop my EA with condition: 1 buy and sell in a cycle of trend, but so far getting failed.
My EA Logic:
1. First time activate the EA, EA will OP BUY and SELL based on signal.
2. After order closed by hit TP or SL, and Signal still goes on EA will not take any position until the opposite signal appears.
Herewith my code, but still not working:
Million Thanks and sorry for my poor English
Alex | Indonesia