Your algorithm needs some structure, start with the easy stuff first.
if ( Open[0]<=BOLL && Open[1]<BOLL )That could be your problem, usually the argument NEVER goes in the same direction. If one is less then < the other have to be > then in order to form a cross section. More than likely your bands are keeping up with your Bars.
Replace
if (OrdersTotal()==0) {trade=false;}
to
if (OrdersTotal()==0) {trade=false;Order = IDLE;}
and
OrderModify(ticketb,0,Ask-(SL*Point),Ask+(TP*Point),0,Green);
to
if(OrderSelect( ticketb, SELECT_BY_TICKET )==true) OrderModify(ticketb,OrderOpenPrice(),Ask-(SL*Point),Ask+(TP*Point),0,Green);
if (OrdersTotal()==0) {trade=false;} if (OrdersTotal()!=0) { for (int i=1; i<=OrdersTotal(); i++) //Cycle for all orders.. { //displayed in the terminal if(OrderSelect(i-1,SELECT_BY_POS)==true)//If there is the next one { if (OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber) { trade=true; break; } else {trade=false;} } } }
This code will set trade to false if the latest trade is not by this EA. The EA should ignore all trade except its own. Since you MUST count down while closing/deleting, get in the habit of always. Simplify:trade=false; for (int i=OrdersTotal()-1; i>=0; i--) if( OrderSelect(i,SELECT_BY_POS) && OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber){ trade=true; break; }
if (trade==false && Order==IDLE)
If trade is false then the Order is irreverent, plus you never set order back to IDLE, so it never trades again. Restructure to this patternif (!trade){ if ( Open[0]<=BOLL && Open[1]<BOLL ){ ticketb=OrderSend(Symbol(),OP_BUY ... } else if( Open[0]>=BOLH && Open[1]>=BOLH ){ tickets=OrderSend(Symbol(),OP_SELL ... } }
and you can then drop the unnecessary code like Order, SIGNAL_SELL- ubzen comment is also validIf one is less then < the other have to be >
WHRoeder:
- This code will set trade to false if the latest trade is not by this EA. The EA should ignore all trade except its own. Since you MUST count down while closing/deleting, get in the habit of always. Simplify:
- If trade is false then the Order is irreverent, plus you never set order back to IDLE, so it never trades again. Restructure to this patternand you can then drop the unnecessary code like Order, SIGNAL_SELL
- ubzen comment is also valid
If one is less then < the other have to be >
Doesn't it just mean that the Open of the last bar is less than BOLL and that the current open is less than BOLL? It looks ok to my novice eye.

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
please help me im stuck with my EA i will give you my all model if you help me