| || |
Executing at trigger price when backtesting
I wrote a EA and tried to backtest it. Found that the trades were always being exeuted at the close of the bar rather than the trigger price. I was using Market order. (Ea.jpg and BK.fxd)
When I changed the order to stops then it looks like they are getting executed at the trigger price (EA_StopBased.jpg and BK_StopBased.fxd)
Can someone advise whether the second method is the correct method or am I thinking its working correctly for the wrong reasons. Want to properly test prior to engaging the EA
In backtesting, Market orders (IMarketOrder) are executed at the close of the bar, unless you enabled intra-bar order generation. Entry orders (IPriceOrder) on the other hand are always executed on the trigger price. There's nothing wrong with your results.
Disclaimer: Trading foreign exchange on margin carries a high level of risk and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. The possibility exists that you could sustain a loss in excess to your investment and therefore you should not invest money that you cannot afford to lose. Before deciding to trade foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. You should be aware of all the risks associated with foreign exchange trading and seek advice from an independent financial advisor if you have any doubts. Any opinions, news, research, analyses, prices, or other information contained on this website is provided as general market commentary and does not constitute investment advice. FXCM will not accept liability for any loss or damage, including without limitation to, any loss of profit, which may arise directly or indirectly from use of or reliance on such information.