A change in direction of a moving average.

Forums ProRealTime English forum ProOrder support A change in direction of a moving average.

Viewing 7 posts - 1 through 7 (of 7 total)
  • #9912

    Hello everyone
    First of all, my apologies for my English …
    I am trying to write the code of one setup i use manually, trying to Improve it, runnig backtests.
    The idea is to identify a change in direction of a moving average.

    For example,

    Exp Moving Average of 9, five days up. The trigger signal is first day pointing down.

    I wrote the code like this.

    Is this correct? It seems to work, but maybe there is a better way…

     

    Any help is welcome.

    Thank You

    #9931

    Hello everyone
    I Finished first version of my setup. Inspired in the setup of Larry Williams.
    The idea is to capture the signal from the direction of change MM9 Exp.
    I still do not know if there is another way to encode the change of direction of a moving average. This was the one that occurred to me.
    If anybody know other way, please share here.

    But the code are not working as it should.
    We should open the position in the breakout of the high / low after the candle that gives the signal; and not in the opening.

    Any sugestions? I dont know what is wrong…

     

    Thank you all

    #9944

    Conditions are always tested at a bar close and trade initiated at the open of the next bar. So obviously, your conditions need to be offset +1 somewhere.

    About your moving average conditions, you could have made a loop through bars to test them with less code lines, but that’s ok too with the way you done 🙂

    #9972

    Nicolas if you have time would you mind providing an example of this with a Loop instead of all the conditions. Thank you for your guidance.

    #10510

    Nicolas, can you teach us how to code the loop to identify a change in the direction of the moving average? Please consider that the average should remain 5 days before turn.

    Thank you.

    #10515

    I see 2 ways to make this test:

    1/ first idea is a FOR/NEXT loop in the previous 5 bars:

    2/ second idea is a SUMMATION of the test result over the last 5 periods:

     

    #10517

    Nicolas, thank you for quick answer.

    i am very happy and gratefull for your help, because i am learning a lot.

    Of course I could not write this loop code, because I am still trying to take the first steps in Prorealcoding.

    Now i will do some backtest and try to make this thing work.

     

    I will give some news about it.

     

    I have several  good daily setups that would like to code in PRT but the problem is the opening.

    Like in this setup, i want to open position in the breakout of the last bar.

     

     

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

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