Working Through ‘Advanced Promgramming’, question. Loops

Forums ProRealTime English forum ProBuilder support Working Through ‘Advanced Promgramming’, question. Loops

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

    Hi, new to the forums, new to ProRealTime programming. First off, having some C coding experience the concept of the code iterating through each bar automatically is a concept I need to get used too. In C/C++ you would need to code that element too.

    I am working through Advanced programming > Loops > Descending loops and got to the code

    My question (probably the first of many) is that as noted in the ‘IF result = 30 THEN signal = 30’ test, once ‘signal’ is equal to 30 it gets set at 30. However the true value of ‘signal’ is 30 or below and does not get reset to 30 again until ‘signal’ moves above 30. Isn’t his poor programming? Shouldn’t ‘signal’ get reset to zero just after the last ENDIF and before NEXT. I realise that this is just a teaching exercise but want to make sure I understand this correctly. Or is it simply dependant on exactly what you are trying to achieve? Thank you for your time.

    #249556

    Sorry, that should read, does not get reset to 0/ZERO again

    #249565
    JS

    Hi,


    In this case, “signal” is not reset due to the use of the “CONTINUE” instruction…

    This ensures that when “result < 30”, the current iteration is skipped and execution continues with the next iteration…

    Therefore, “CONTINUE” ensures that “signal” is not reset (because the code below the “CONTINUE” statement is not executed).

    #249566
    JS

    By the way, welcome to the forum… 😉

    #249575

    Thank you for that JS. I guess what I am trying to say is aren’t we getting false information? We do in fact have values of 30 or less (hypothetically they could in reality be 5, 10 ,20) but looking at the signals on the indicator they are all showing 30. So the indicator is surely showing incorrect information? In the previous code without, the CONTINUE instruction, we only generate two signals at 30, which is surely correct. That is why I thought ‘signal’ should get reset to zero just after the last ENDIF and before NEXT.

    #249576
    JS

    Why does it show false information?

    When you don’t use “Continue”, your indicator correctly shows the two values (result and signal)…

    #249640

    Thankyou for the clarification JS

    1 user thanked author for this post.
    avatar JS
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