if you run multiple EA's, on multiple currencies/charts and instances, you DEFINITELY NEED MAGIC NUMBER. :-|
if you run multiple EA's, on multiple currencies/charts and instances, you DEFINITELY NEED MAGIC NUMBER. :-|
But problem happen when i trade more than one pair currency ! (Same EA loaded into different pair currency chart).
Sorry ! Forgot to specific my problem. When i loaded the code below to a pair of currency,it work fine and only allow to open a new position when
condition meet.
When i loaded the EA into a second pair of currency/chart, it do nothing !
No position was open when open criteria is meet !
// Orders accounting Symb=Symbol(); // Security name datetime lastOP; // Amount of orders for(int i=0; i<OrdersTotal(); i++) // Loop through orders { if (OrderSelect(i,SELECT_BY_POS)==true && OrderSymbol() ==Symb && OrderType() <=OP_SELL) // If there is the next one // Another security Ticket=OrderTicket(); // Number of selected order Tip =OrderType(); // Type of selected order Price =OrderOpenPrice(); // Price of selected order SL =OrderStopLoss(); // SL of selected order TP =OrderTakeProfit(); // TP of selected order Lot =OrderLots(); // Amount of lots { if (OrderOpenTime() > lastOP) lastOP=OrderOpenTime(); } } //------------------------------------------------------------------------------------------+ // Check last Open datetime lastClose; // Amount of orders for(int pos=0; pos<OrdersHistoryTotal(); pos++) // Loop through orders { if (OrderSelect(pos,SELECT_BY_POS, MODE_HISTORY) && OrderCloseTime() > lastClose && OrderSymbol() == Symb && OrderType() <= OP_SELL) lastClose=OrderCloseTime(); lastOpen=OrderType(); } //+---------------------------------------------------------------------------------------+
Well the code that you have posted will never open a position . . there is no OrderSend . . .
Hi RaptorUK,
Here my OrderSend
OK, here is your problem . . .
// Check last Open datetime lastClose; // Amount of orders for(int pos=0; pos<OrdersHistoryTotal(); pos++) // Loop through orders { if (OrderSelect(pos,SELECT_BY_POS, MODE_HISTORY) // <----- if this is true . . . && OrderCloseTime() > lastClose && OrderSymbol() == Symb && OrderType() <= OP_SELL) lastClose=OrderCloseTime(); // <--- . . . this is executed lastOpen=OrderType(); // <--- this is executed all the time regardless of anything in the if statement above }
maybe you meant this . . .
// Check last Open datetime lastClose; // Amount of orders for(int pos=0; pos<OrdersHistoryTotal(); pos++) // Loop through orders { if (OrderSelect(pos,SELECT_BY_POS, MODE_HISTORY) // <----- if this is true . . . && OrderCloseTime() > lastClose && OrderSymbol() == Symb && OrderType() <= OP_SELL) { lastClose=OrderCloseTime(); // <--- . . . this is executed lastOpen=OrderType(); // <--- this is executed all the time regardless of anything in the if statement above } }
OK, here is your problem . . .
maybe you meant this . . .
Hi RaptorUK,
My problem solved ! Thank You Very Much !!!!!!!!!!!!
If can i sincerely wish to buy u a cup of coffee.
Thanks again.....
if you run multiple EA's, on multiple currencies/charts and instances, you DEFINITELY NEED MAGIC NUMBER. :-|
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Please Help or advice ! Currently i'm using the code at above to open/close a trade and it working fine.
But problem happen when i trade more than one pair currency ! (Same EA loaded into different pair currency chart).
Thanks in advance.