Backtest Nicolas "TrendFollowingMovingAverage"

Forums ProRealTime English forum ProOrder support Backtest Nicolas "TrendFollowingMovingAverage"

Viewing 13 posts - 1 through 13 (of 13 total)
  • #136236

    Hi everyone. I got interested in Nicolas Trend Following Moving Average and decided to backtest a simple strategy based on his indicator, which can be found here: https://www.prorealcode.com/prorealtime-indicators/trend-following-moving-averages/.

    However I seem to not fully understand the code which makes it hard to make a backtest. I would simply like to buy when the entire “cloud” is green and sell when it is red. Alternatively, buy when close crosses over the “cloud” and sell when it crosses under. As it stands, the program doesn´t make any trades whatsoever. Could someone please check my code and see what I´m doing wrong?

     

    #136239

    Is line 55 correct?

    prev is not used anywhere else in the strategy and what is the $ doing?

     

    #136241

    Hello GraHal. If you check the original code from Nicolas indicator you see that before line 59 there is the “drawsegment” line. Since this line is not required in Probacktest I decided to remove it. Perhaps prev[p] should be removed aswell?

    #136242

    Anyway, have you got PRT v11 as Nicolas Trend Following Moving Average only works on V11 onwards!

    #136243

    Yes I know, I am using V11 for this backtest so it shouldn´t be a problem. I´m simply wondering why it is not taking any trades?

    #136253

    There is something wrong by the calculation in the loop. I’m investigating it and let you know if I can make it working.

    The code i’m using is this one: (for debugging purpose)

     

    1 user thanked author for this post.
    #136349

    Thank you very much for taking the time to investigate @Nicolas. I hope we can find the solution!

    #136371

    I solved the problem, you made a change in the code that result in a wrong calculation of the moving average … anyway, here is the version that buy only (but with no exit either in loss or profit, i let you manage that!).

     

    #136383

    Excellent, thank you very much for the help Nicolas!

    #136393

    Sorry to disturb you again @Nicolas but the system is still not working properly. I tried the “green = count” command and the entrys are almost completely wrong, it even enters trades when the average is red. So I tried writing and indicator with a simple “green crosses over red” command, and it shows exactly and properly where I want to enter (white arrows in the attached image). So I tried writing the same function into the backtest but the entrys are still the same (way to late after the green trend has started and during red periods) as shown by the blue arrows. I´ve tried a bunch of different entry criterias now and none of them seem to enter where they are supposed to, i.e where the white arrows are. Here is the most recent code I´ve tried:

     

    #136394

    graph green

    graph red

    should give you valuable informations.

    #136484

    Yes I can see that the “graph green” and “graph red” correlates with where my system enters and exits a trade. But those graph instructions doesn´t correlate with the actual colours of the moving average at all so it still doesn´t help me any further. Seems to me like the “graph green” and “graph red” instructions display a green trend when the moving average is obviously red and vice versa?

    #136533

    Settings of the strategy the same as the one of the indicator displayed on the chart? Linear regression use or not, period, ..

Viewing 13 posts - 1 through 13 (of 13 total)

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