Hello Members,
I was backtesting "MACD sample EA" then adding an "order status indicator" which shows numbers of active open orders data on the visual chart.
But in spite of having active open orders from the EA, the order status Indicator is failed to show any open orders data on the chart.
So does the indicator orderselect() function works during backtest ?
Thank you
Regards
If it works then why it doesn't show open orders data as it shows on live charts?
Here I rephrase,
I added "MACD Sample" EA on visual backtest. On that same chart, I added the order status indicator with "orderselect()" function. But in spite of having open orders on the visual chart, my orders status indicator doesn't show anything, like 0 active orders, whereas visual tester has open orders.
Indicators can/do not handle orders...
There is no such thing as indicator orderselect() function.
Somsri Sarkar: If it works then why it doesn't show open orders data as it shows on live charts? But in spite of having open orders on the visual chart, my orders status indicator doesn't show anything, like 0 active orders, whereas visual tester has open orders.
| OrderSelect works just fine in 1090 (demo)bool t=OrderSelect(0, SELECT_BY_POS); printf("os(0)=%i Fail:%i T=%i", t, _LastError, OrderTicket() ); // 2017.05.29 07:52:42.198 testIndi EURUSD,H4: os(0)=1 Fail:0 T=142553347Is there something in the Experts tab? Post your code. |
Marco vd Heijden:
Indicators can/do not handle orders... There is no such thing as indicator orderselect() function. | Indicators can not sleep nor trade, but OrderSelect isn't a blocking call. |
OrderSelectworks just fine in 1090 (demo)Is there something in theExpertstab? Post your code. | |
Indicators can not sleep nor trade, butOrderSelectisn't a blocking call. |
Thank you whroeder for your input.
I created a testing indicator with your code. Then started "MACD Sample EA" for visual test adding with the test indicator on the chart.
at the journal tab, it shows such results
2017.05.30 10:47:48.280 2017.05.05 02:26:00 Testing Orders GBPJPY,M1: os(0)=0 Fail:4051 T=0
Invalid function parameter value.
I tried testing with different other EA and then adding my orders status indicator for display on the EA visual chart. But it didn't work.
It's not possible to backtest an order status based indicator, as it doesn't involve any live trade during backtest. That's why with an EA, I tried to backtest it.
Here is the sample code of the orders status indicator: (Which works perfectly on live chart)
string type; for (int b = OrdersTotal()-1;b>=0;b--) { if(OrderSelect(b,SELECT_BY_POS,MODE_TRADES) == true && OrderType() == OP_BUY) type = "Buy"; if(OrderSelect(b,SELECT_BY_POS,MODE_TRADES) == true && OrderType() == OP_SELL) type = "Sell"; string Name = IntegerToString(b)+"U"; int yd = 5+b; ObjectCreate(Name, OBJ_LABEL, 0, 0, 0); ObjectSetText(Name,type+IntegerToString(b),12,"Arial",clrRed); ObjectSet(Name, OBJPROP_CORNER, 0); ObjectSet(Name, OBJPROP_XDISTANCE, 5); ObjectSet(Name, OBJPROP_YDISTANCE,yd); }
Write the order select code into the EA.
A separate indicator will probably not work with the backtesting results.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello Members,
I was backtesting "MACD sample EA" then adding an "order status indicator" which shows numbers of active open orders data on the visual chart.
But in spite of having active open orders from the EA, the order status Indicator is failed to show any open orders data on the chart.
So does the indicator orderselect() function works during backtest ?
Thank you
Regards