Coding cross over problem

Forums ProRealTime English forum ProOrder support Coding cross over problem

Viewing 8 posts - 1 through 8 (of 8 total)
  • #81081

    What is  wrong in this code ?

    I have an indicator that crosses an average of the indicator as a buy/sell signal , in this case going short.

    The closing of  this position is done by the reverse cross. (see picture test)

    However the execution in backtest shows that the position is covered randomness without taking in account the “closing condition” ; worse it opens a new short without satisfying the “condition”…

    Where is the problem in this code?

    Any suggestion is welcome.

     

    #81139

    Were the settings the same in the strategy and on the chart?

    Which instruments?

    Which TF?

    Which date/time is the trade under investigation?

     

    #81163

    and keep in mind that DPO is not suitable for automatic trading, as the internal instruction make use of future datas, which is obviously not possible in real time.

    1 user thanked author for this post.
    #81231

    Nicolas,

    According to the definition the Detrended Price Oscillator (DPO) measures the difference between a past price and a moving average. The detrended price oscillator is calculated and utilized from the variables shown below:

    X is first determined by the number of periods; 20 day or 30 day periods are common. Simple moving average over an “n” day period is needed.

    DPO = Closing price – Simple moving average [from (n / 2 + 1) days ago]. It is possible to displace the Detrended Price Oscillator (DPO) with a horizontal shift to the right. (see picture of the setting Prorealtime  in attachment.)

    So I do not understand what you mean by : ” the internal instruction make use of future datas” . Can you clarify ? Thank you for your efforts.

    Brgds

    J-P

    #81233

    Robberto

    The answers on your questions:

    Were the settings the same in the strategy and on the chart? YES

    Which instruments? DAX Futures

    Which TF? Day

    Which date/time is the trade under investigation?  from 28 november 2015 till 20 september 2018

     

    Thank you for your reply.

    Brgds

    J-P

    #81237

    So I do not understand what you mean by : ” the internal instruction make use of future datas” . Can you clarify ?

    If you try to run a strategy live with DPO then you will get a message telling you that it is not an indicator that can be used for live trading. This is the same for all similar indicators that re-paint in the future such as the zig-zag They look great because they change in the future. For this reason it is not worth continuing to develop strategies based on these type of indicators.

    1 user thanked author for this post.
    #81252

    @didi059

    You are right, but if you look carefully at the oscillator by reloading the chart, let’s say each 10 minutes, you’ll see different information, because that’s how the DPO is made in the platform. You have the choice to choose between the future and past datas in its settings.

    There are plenty of topics in the forums which deal about the DPO and its repainting behavior. You can also have a look at this one where you’ll find the code for the DPO that use the past data: (but indeed not as accurate than the one which has the crystal ball!! 😆 ) https://www.prorealcode.com/topic/detrended-price-oscillator-dpo/#post-13747

    1 user thanked author for this post.
    #81286

    Nicolas

    All clear, thank you!

    Brgds

    J-P

     

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

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