maColLen = maColLen * (maCol = maCol[1]) + 1 is working differently PRT 11/10

Forums ProRealTime English forum ProBuilder support maColLen = maColLen * (maCol = maCol[1]) + 1 is working differently PRT 11/10

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

    I was just writing this simple code, and I noticed that it’s working differently in PRT v10 and v11 (“LMAX v10.3 – 1.8._202” and “IG v11.1 – 1.8._202”).
    On v11 I am getting the expected behaviour, on v10 it’s odd…

    The problem is with the “maColLen”, on v10 is always undefined, on v11 it works as I expected…

    At first I thought that it was “(maCol = maCol[1])” considered as a boolean and not as a 0/1 as it normally should and could not work as it should.
    But I tried this other small piece of code and I understood that it’s not the case, because this is working good on both v10 and v11:

    So I think that the problem is linked to the “maCol[1]” inside of the “(maCol = maCol[1])”.
    Or maybe it’s me that I have misunderstood something…
    I would like to have a clearer understanding of this at a low level.
    Thank you in advance.

    #159785

    Try initialising it:

     

    #159788

    Yeah, I tried that too (just above the maColLen = maColLen * (maCol = maCol[1]) + 1), but it’s always undefined.

    #159810

    Add:

    at line 4, then ENDIF at line 19.

     

    #159834

    Thank you for the correction proposal to make it works.
    Ok it works now… And I can understand the correction.

    But I still don’t completely get why they reacted differently.
    So I have done some research on that and now I think i’m getting closer at why at low level it’s working differently.

    Fact 1:

    PRT 10 and 11 behaves completely differently when it comes to compare a value with the undefined.

    This is returning undefined on PRT v10 and zero on PRT v11

     

    Fact 2:

    A simple variable as maColLen by default (if not used with a function like average on the right of assignement) is 0, and you can prove that with that indicator (which returns 0 both on PRT 10 and 11):

     

    Fact 3:

    A simple variable as maCol if it’s set equals to maCol[1] on first bars will give you undefined (both on 10 an 11):

     

    So now that I have those fact in mind we have three cases:

    • bars < 20
      • ma is undefined
      • maCol is undefined (for fact 3, for the else line of ma color)
      • so maColLen = maColLen * (maCol = maCol[1]) + 1 —> maColLen = 0 * (undefined) + 1   on PRT 10 and    maColLen = 0 * (0) + 1  on PRT 11
    • bars = 20
      • ma is a value but ma[1] is not a value
      • maCol is undefined (for fact 3, for the else line of ma color)
      • so maColLen = maColLen * (maCol = maCol[1]) + 1 —> maColLen = 0 * (undefined) + 1   on PRT 10 and    maColLen = 0 * (0) + 1  on PRT 11
    • bars > 20
      • ma and ma[1] is a value
      • maCol is a value +1, -1 (i’ll not consider the ema to be flat between bar 20 and 21)
      • so maColLen = maColLen * (maCol = maCol[1]) + 1 —> maColLen = 0 * (a value) + 1   —> why at this point PRT 10 should not work? I don’t get this…

    Is this all correct? Or I’m wrong at a certain step?
    I’m not getting why PRT 10 is not giving values… i.e. why on the bulleted list above “bars > 20”, point third is still not working on v10.
    I just wish I had a better understanding of what’s going on.
    Thanks again for your patience.

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