Indicator and Backtest, same algorithm, Backtest out by a day

Forums ProRealTime English forum ProOrder support Indicator and Backtest, same algorithm, Backtest out by a day

Viewing 5 posts - 1 through 5 (of 5 total)
  • #56988

    Happy New Year everyone. I was hoping someone can clear my illogical thinking please.
    I have a simple algorithm that works as an indicator as expected but when implemented as a backtest it
    flags the buy and sell a day later than it should. Its probably my coding or I’ve made an incorrect assumption
    but the last thing I want is it flagging a buy when its a sell and visa versa. Also, I dont want to have errors as I refine
    from here even on a simple piece of code going forward.
    The Indicator code is:

    The Backtest code is:

    Nothing too tricky really. Its based on the visual in the attached file and the behaviour can be seen
    in the chart dump in the other file.

    CCIalgorithmReduced3

    The backtest clearly lags the indicator and the actual indicator by a day.
    Thanks for any assistance you can provide,
    John

    Backtest-vs-Indicator-01-Jan-2018-21_49

    #56992

    Code is read at Close and actions are made at next Open, that’s the behavior of ProBacktest/ProOrder and the reason you think you have such differences between indicators and automatic trading programs.

    1 user thanked author for this post.
    #56997

    Thank you Nicolas for your answer and prompt response. I think I understand now.

    So I shouldnt use the backtest for identifying buy/sell signals for the next day? I should rely on screeners and indicators?

    What about for automated trading, does the signal fire on the indicator? Its a little confusing.

    Regards

    John

     

    #57008

    Line 9 of the indicator code will only be true once, when the indicator starts, later it will always be either 1 or -1.

    Is that what you want?

    #57139

    Hi roberto,

    Yes, this is what I wanted to do originally. 0 is the initial state only. I wanted the transition of state to remain until it changes, so I could see whether I remain in or out without having to hunt back.

    I’ve done two versions now, and see advantages both ways.

    Thanks for pointing it out,

    John

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

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