i want to fix max 3 buystop trades and 3 sellstop, (not all time trade at a time, one by one, one close another start if condition met) in single bar....
need some help in my code for M15 time frame which 15*60 = 900 sec one bar, if bar end start initial state
my code works as indicator but not working as EA in backtest, is backtest not send order comments?
send with order comment as buy1, buy2,......
need some help in my code for M15 time frame which 15*60 = 900 sec one bar, if bar end start initial state
my code works as indicator but not working as EA in backtest, is backtest not send order comments?
Inserted Code
int start() { datetime co = iTime(Symbol(),0,0); datetime ct = TimeCurrent(); datetime cp = iTime(Symbol(),0,1); int a = cp+899; double high = iHigh(Symbol(),0,0); double low = iLow(Symbol(),0,0); for(int i=OrdersHistoryTotal()-1;i>=0;i--) { OrderSelect(i, SELECT_BY_POS,MODE_HISTORY); if(OrderSymbol()==Symbol() ) { datetime hc = OrderCloseTime(); datetime ho = OrderOpenTime(); if (OrderType()==OP_BUY && OrderComment() == "buy1" && ho>co && hc>co && (ct-hc)<800 ){ buy2 =2; buy1 =0; buy3 =0; } if (OrderType()==OP_BUY && OrderComment() == "buy2" && ho>co && hc>co && (ct-hc)<800){ buy3 =3; buy1 =0; buy2 =0; } if (OrderType()==OP_BUY && OrderComment() == "buy3" && ho>co && hc>co ){ buy3 =0; buy1 =0; buy2 =0; } //return(0); break; } } static datetime New_Time = 0; bool New_Bar = false; if (New_Time!= Time[0]) { New_Time = Time[0]; New_Bar = true;} if (New_Bar == true){ buy3 =0; buy1 =1; buy2 =0; } //--- RefreshRates(); Comment(" " + buy1+ " // " + buy2 + " // " + buy3 ); return(0); }
send with order comment as buy1, buy2,......