For Statements

  • This topic has 7 replies, 2 voices, and was last updated 7 years ago by avatarWing.
Viewing 8 posts - 1 through 8 (of 8 total)
  • #26868

    Can you use for statements for automated trading, where each indicator refers to the last bars value?

    Just a random example:

    Doesn’t seem to work for me.. Is it allowed?

    #26869

    Could it be that you spell ‘indicator’ differently on row 18 and 20?

    #26870

    Good eye!

    But sadly, no.. It’s just an example I made up now.

    #26871

    What is the error message you receive, if any? Is there a value returned for a, b and c? Does it work with say, 30 iterations instead of 100? Could it be the close cross under indicator check that does not work?

    #26872

    Literally nothing happens, I get the summary (but no trades). And I tried all kinds of conditions apart from ‘cross under’.

    #26873

    Use the ‘graph’ function and check how each of your variables behave.

    #26874

    They are displayed correctly; that’s the weird part.

    #26875

    Do you define all your variables from the start, and have you tried for example defparam preloadbars=1000? Also, isn’t the value of ‘indicator’ much greater than the close price? I don’t think there is anything wrong with your method or the for statements here, but rather the example you have. Here is for example an indicator I have made that uses for statements to gather data from previous bars: https://www.prorealcode.com/topic/pattern-matching-price-movements-in-prt/

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

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