Can you show an extract from the log file where this has happened, show the placing of the Order and the hit on the SL . . can you also show the section of the report where the trade was placed and closed by SL
What is Expiry set to ?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
Apologies if this is something glaringly obvious that I have overlooked, but it is starting to really frustrate me. I've developed an EA that will place buystops and sellstops when certain pivot criteria are met. I'm using for example
OrderSend(Symbol(),OP_SELLSTOP,Lots,openPrice,slip,stopLoss,takeProfit,"Sell Order placed at "+CurTime(),<generated magic number>,Expiry,Red);
To place my pending order when conditions are correct. ie for a sellstop, the current price is above the openPrice and a few other factors based on fibo etc. This all seems to work fine and the order is setup correctly when it is placed. On a realtime chart it works perfectly.
The problem occurs when I try and backtest this EA with the strategy tester. Once the pending order is placed, if it hits the stoploss even if the order hasn't been triggered, it immediately executes the trade and stops out, effectively showing a loss in the backtest. This is then incorrect, it shouldn't have been stopped out as the openprice of the pending order was never hit so the order isn't live.
And to further prove the point, as I say it works fine on a live chart with real trades, stoploss only kicks in once the order has been triggered and becomes live.
Am I going completely mad or is this some sort of bug in the strategy tester? I'd really like to be able to backtest my ea, but this just blows the results out the water
Thanks in advance to anyone that can shed some light on this for me.
Cheers
Paul