Backtesting not working properly - stop losses

 

I have built and tested an EA & found that it didn't work to code when backtesting. Specifically, the stop loss function. I downloaded the sample codes (moving average & MACD) and tested them with the same result despite those EAs having a stop loss exit function.

On checking the code, I realised that the stoploss functions relied on the pre-defined variables - Bid and Ask. And it appears that backtest data does not provide Bid & Ask prices, but rather only prices of transacted lots. Therefore the value of Bid & Ask appears to be 0 and subsequently. the algorithms using Bid & Ask will not work correctly.

1. Am I correct in this assessment?

2. If so, what predefined variable can I use to susbstiute for Bid & Ask to get a realistic backtest?

3. If there is no substitute for Bid & Ask in a backtest scenario, then does anybody have any ideas on how to create one.

Cheers

Michaelf

 

1. No.

2.

3.


CB

 

Hi M

The back tester simulates a normal chart and makes up prices to feed to the EA that is the whole point so in theory you test in the back tester then put on a live chart making no changes. If you can't get a sample to run you must have a setting wrong in your back tester or no history data for it to run so check for errors in the log and journal.

Reason: