Initialization not working

Forums ProRealTime English forum ProOrder support Initialization not working

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

    Hello,

    The outcome of the following code is exactly the same as if “Close” was 0 in the “ONCE” instructions, and all the remaining code did not exist.
    GRAPHing my variables produces flat lines whereas GRAPHing the formulas used to calculate them produces correct graphs.
    It looks like assignations don’t work.
    What am I missing here?
    (It’s a very simple ProBackTest system based on 2 trailing stops, one to open a long position and another one to close it.)

    Thanks for your help!
    Stephane

    #121636

    Please do not open multiple topics with the same question.

    First idea that come to mind:

    1. at first run, PriceBaseStage is equal to 0 and a division by zero error has the effect of stopping future evaluations of the variables
    2. try to limit the preloaded bars with a defparam preloadbars=0 , to exclude calculation before the real start date of the backtest
    1 user thanked author for this post.
    #121790

    Thank you Nicolas.

    PriceBaseStage is a variable which is set to 1000, so it is never equal to 0.
    Unfortunately, DEFPARAM PreLoadBars = 0 doesn’t change anything.

    I was suggested by Fifi743 to use an indicator instead of doing the calculations in the system. It generally helps.
    However here, it doesn’t improve the outcome.
    Looks like the ONCE calculations are made out of any bars (hence “Close” seemingly equal to 0).

    Has anyone experienced this phenomenom? I’m pretty sure there’s an obvious fix or workaround…
    Thanks!

    #121797

    Could you please give me a example with fixed settings (with no optimization) applied to a specific instrument on a precise date/time? Sorry but i’m a bit a confused on when/where to test it as it should.

    #121858

    Finally got the solution from Noobywan on the French forum.
    Instead of using ONCE, rely on testing BARINDEX.
    Thanks Noobywan!

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