How to count iterative bars

Forums ProRealTime English forum ProBuilder support How to count iterative bars

Viewing 6 posts - 1 through 6 (of 6 total)
  • #80181

    Hi All,

    In the past I have successfully programmed snippets of code in VBA and other languages … but I am struggling with counting in ProRealTime.

    Having played with the variables and ran it in ProBacktest – it’s not getting much clearer to me.

    What I am trying to do is Buy or Sell based on Condition 1 (C1) or Condition 2 (C2) respectively and close at the end of what would be the same 5 minute bar.

    As I need to buy at the beginning of the 5 min candle and sell at the end, I have set the bar to 10 second so that I can buy 10 seconds after C1 or C2 is satisfied (beginning of second bar) and then count 29 more bars to close after 5 minutes i.e. 300 seconds.

     

    When run on Probacktest I get counts of 29 and other times 95 or other number of bars on the market.

    I did start using a FOR/Next loop but had other problems …

    Any ideas most welcome, Thank you!

    #80187

    What are timeEnterbefore AND timeEnterAfter?

    Did you try to GRAPH x? To know if it is correctly incrementing?

    #80193

    Hi Nicolas,

    The variables TimeEnterBefore = 150000 and TimeEnterAfter = 210000

    I will have a look at ‘GRAPH x’

    Thank you

    #80194

    The variables TimeEnterBefore = 150000 and TimeEnterAfter = 210000

    I’m not sure you gave me the right values 🙂 It should be 2 boolean variables, and they are not!

    #80197

    Hi Nicolas,

    The preceding lines were:

    noEntryBeforeTime = 150000
    timeEnterBefore = time >= noEntryBeforeTime

    noEntryAfterTime = 210000
    timeEnterAfter = time <= noEntryAfterTime

    Thanks

    #80199

    Hi Nicolas,

    Thank you for your time … suggesting ‘Graph x’ has allowed me to see step by step what is going on.

    I haven’t figured out yet why I am losing a count of one but feel confident that being able to zoom in and examine the execution of the code in relation to the count of ‘x’ using ‘Graph’ I’ll have it sorted.

    Thank you for your patience and advice.

    Joe

    1 user thanked author for this post.
Viewing 6 posts - 1 through 6 (of 6 total)

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