I am having an EA that I am running using forward testing, but I keep on having a problem. I can't have simultaneous active orders on different charts (with each chart representing a different pair).
I have the Symbol check every time and yet can't seem to find why multiple orders with different currencies are not applied. It is true that trades with different pairs happen, but only one pair each time. I was hoping to have multiple pairs having an active order each pair would have one order at a time. But I have one order for all pairs happening once.
Below is the key code where the order is triggered. Am I missing something?
Thanks for your help in advance.
Code:
</orderopenprice()+point*5)></total;count++)>
I have the Symbol check every time and yet can't seem to find why multiple orders with different currencies are not applied. It is true that trades with different pairs happen, but only one pair each time. I was hoping to have multiple pairs having an active order each pair would have one order at a time. But I have one order for all pairs happening once.
Below is the key code where the order is triggered. Am I missing something?
Thanks for your help in advance.
Code:
QuoteDislikedint start()
{
int count;
if(Bars<100) { Print("bars less than 100"); return(0); }
total=OrdersTotal();
if (trend!=0) { last_trend=trend; }
trend=MACD_Direction();
strength=trend_strength();
if (pending_time>0) last_pending_time=pending_time;
for(count=0;count<total;count++)>
{
OrderSelect(count, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY && find_highest)
{
trailing_stop(1);
if (Close[0]>=OrderOpenPrice()+Point*5) { pending_time=0; revival_attempts=0; opposite_trend_duration=0; opp_trend_period=0; }
if (Close[0]<orderopenprice()+point*5) {="" pending_time="" last_loss="OrderOpenPrice()+Point*5-Close[0];" opp_trend_period="0;}<br"> if (strength<=-0.95*MACD_level) opp_trend_period++;
if (best_deal()>0) ClosePending();
}
else if (OrderType()==OP_SELL && find_lowest)
{
trailing_stop(2);
if (Close[0]<=OrderOpenPrice()-Point*5) { pending_time=0; revival_attempts=0; opp_trend_period=0; }
if (Close[0]>OrderOpenPrice()-Point*5) pending_time++;
if (strength>=0.95*MACD_level) opp_trend_period++;
if (best_deal()>0) ClosePending();
}
}
}
if (trend>0 && strength>=0.95*MACD_level) { buy_flag=true; sell_flag=false; last_trend=trend; }
if (trend<0 && strength<=-0.95*MACD_level) { sell_flag=true; buy_flag=false; last_trend=trend; }
if ((sell_flag==true || buy_flag==true) && total==0 && trend!=0)
{
if (buy_flag==true) do_order(1);
if (sell_flag==true) do_order(2);
}
}