number of bars passed since last zigzag

Forums ProRealTime English forum ProBuilder support number of bars passed since last zigzag

Viewing 4 posts - 1 through 4 (of 4 total)
  • #227445

    hi! using the standard built-in zigzag function, how can I find out:

    1. the number of bars that have passed since the last zigzag (peak or bottom) occurred and now?
    2. the closing price of that last zigzag (peak or bottom)?
    #227459

    Hi there 😊!

    To retrieve information using the built-in ZigZag function in ProRealTime for:

    1. The number of bars that have passed since the last ZigZag (peak) occurred
    2. The closing price of that last ZigZag (peak): Once you find the bar where the ZigZag indicator shows a peak, you can record the closing price of that bar.

    Here’s a simplified example of how you might write this in ProRealTime’s coding language:

     

     

    2 users thanked author for this post.
    #227485

    thank you Nicolas, that worked 🙂

    #227491

    I enhanced the code for both peaks and bottoms which works fine (medium pane)

    Then I wanted to write a trading system and stumbled accross an error “your trading system uses obsolete instructions which are not supported by the backtesting engine (ZigZag)”

    Sadly read that zigzag is not supported for trading systems 🙁 So manually coded it which works fine too:

    But upon trying to calculate the bars that have passed since last (either peak or bottom), my code messed up (lower pane):

    any idea where the calculation should be corrected?

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

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