Announcement

Collapse
No announcement yet.

Help for my First Backtest code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help for my First Backtest code

    I have spent many many days and hours on trying to write a back testing efs for a trading system based on a 5 minute chart. I have used Alexis’ “BasicMAx2(backtesting-alerts)” [Max2-BackTest] as the basis for the coding. This is my first back testing code and there are numerous errors.
    Some of the errors that I can see from a visual observation of the chart are:

    Long stops are not always plotted. When they are plotted they are not below the entry bar but could be a few bars later. The same applies to the short stops.

    The low of the long entry bar is not always above MA3 [which is my entry condition] and the high of the short entry bar is not always below MA4 [another condition] although with less frequency. Worst still are occasions when long entries are made below MA4. The short entries appear to be OK.

    The EOD close of any open trades appear to be on the 15:35 bar instead of the 15:30 bar.

    I have commented out the Check for Profit Target exit code block as it is causing unexpected results with the whole code while not plotting the shapes on the chart.

    As a result of all these discrepancies I am not able to tell if the whole code is working or much less whether the results can be relied upon as a fair representation of the back test.

    I have only included relevant parts of the code and would appreciate any help to sort out my mistakes mentioned above including any other non apparent errors.
    Thank you.
    Robert
    Attached Files
Working...
X