Trade does not always run in backtest

Forums ProRealTime English forum ProOrder support Trade does not always run in backtest

Viewing 3 posts - 1 through 3 (of 3 total)
  • #38240
    EB

    Hi,

    I am struggling with a code for some time. It seems to work for some cases, but strange enough not all of the times during the backtest.

    I am trying to code the following:

    c1 = Moving average 20 > Moving average 50

    c2 = Stochastic close [1] < 21 and stochastic close [0] >= 21

    c3 = abs(bollingerup close[0] – abs(bollowingerdown close[0])>1

    the combination of c1, c2 and c3 is reguired to buy a contract. Attached a screenshot of the graph with a example where I should expect a trade opening and a screenshot of the code.

    As a test I changed c1, c2 and c3 variables and each time the result shows different results, so apparently all conditions seems to work.

    Could please somebody  take a look and see what I am doing wrong? Why does it generate trades, but not for all the situations, when c1, c2 and c3 are valid?

    Thank you!

     

    #38251
    EB

     

    #38259

    You can GRAPH your 3 conditions on the chart while doing your backtest, this is how you should debug your problem:

    You’ll be able to compare what you expect as a signal and the one your code is actually returning.

    1 user thanked author for this post.
    avatar EB
Viewing 3 posts - 1 through 3 (of 3 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login