Using Loops

Viewing 9 posts - 1 through 9 (of 9 total)
  • #6198

    In the manual it advises not to use Loops but I would appreciate if someone could share an example of when a Loop would be useful so I can expand my understanding on them for potential ProOrder AutoTrading. If someone has an example it would be very much appreciated.

    #6213

    Hello,

    We can do loops for a lot of things. They are made to increment or decrement variables to search for informations.

    There are some examples in our online documentation in this pages :

    (basic example of adding the moving average of the “i” period to the “a” variable)

    http://www.prorealcode.com/documentation/for/

    (another basic example of a loop using While/Wend : while “i ” is different from 11 we keep incrementing its value of the “Count” variable too)

    http://www.prorealcode.com/documentation/while/

     

    Hope it would be helpful.

    #6240

    Nicholas thanks for the links but I’m still not sure how to completely implement the Loops or still have a practical example in use except for below for an indicator.

    1. I tried copying and pasting the examples in the links but  they didn’t work for me
    2. Can Loops be used in developing Automatic Trading systems (without calling the indicator)? I haven’t seen anyone use loops in their online postings.
    3. Can Loops be used in developed Indicator Creation? Yes

    I found this example in Break indicator that worked for me: http://www.prorealcode.com/documentation/category/instructions/

    4. Is there a way to change the display to Histogram instead of line chart? I found it, yes you apply the settings on the actual chart 🙂

    1 user thanked author for this post.
    #6242

    You can use loops any where you want.

    You’ll find an interesting example in my recent screener here :

    http://www.prorealcode.com/prorealtime-market-screeners/intraday-volatility-explosion-screener/

    I create a loop over the last xCandles  to test the bollinger bands and the keltner bands states in the past datas. That’s at least a practical example of what we can do by using loops. Hope you’ll understand better here. 🙂

     

    #102938

    Hi there,

    if i was using a loop with the MIN function, I would like to know on which number/loop value this MIN value is attained. (e.g.- the loop is set to run from values 1 to 10, and the MIN was reached on loop value #5).

    I would like to be able to find the loop value that gave me the MIN answer.

    Could anyone please help me with how to do this?

    Thanks,

    Finning

     

    #102960

    Something like this? c = the loop count where the lowest value was found.

    #102995

    Hi Vonasi, that looks along the lines of what I was trying to do.

    A question I had-and it looks like you can from the example code you supplied-can you run more than 1 action/equation in the same loop?

    I had a go at writing my own loop-in the code supplied below-will it do what I want and the z[1] reference the z in this loop -or will the z[1] reference the z value of the bar before?

     

    Thanks,

    Finning

    #102996

    Sorry!! Am on mobile and the code paste didn’t work properly!!!

    Am away from desktop for next couple of days.

    #103002

    Code tidied up for you.

    Yes you can do whatever you like within the loop as long as it avoids an infinitive loop situation.

    Your code example does not use the value of f1 unless it is used to calculate g1 and g2 so it is difficult to know if it will work as you want without knowing what g1 and g2 are!

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

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