Periods since close below Supertrend

Forums ProRealTime English forum ProOrder support Periods since close below Supertrend

This topic contains 2 replies, has 2 voices, and was last updated by avatar Damian Lee 3 months, 4 weeks ago.

View all attachments


Viewing 3 posts - 1 through 3 (of 3 total)
  • #104664


    Looking to try and code to return number of periods since when the close crosses above (or below) the supertend, and then note the last value of the supertrend prior to the close crossing it. I can see the barindex and tradeindex but don’t know how to refer to any other condition.

    Thanks in advance 🙂


    I moved your topic to ProOrder support, since you are referencing TRADEINDEX which is related to strategies.

    This is the code:

    Basically you have to keep track of the bar when the crossing occurs and, at the same time, save the value of the CLOSE prior to the crossing.

    Clear all values and flags when a reverse crossing occurs.

    At the end of the code, PREVCLOSE, if other than 0, will retaing the CLOSing price the candle before the crossing occurs.

    To tell how many bars have elapsed, in case CROSSOVER/UNDER > 0, just use the expression:



    Thank heaps for that.  Sooo much appreciated

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

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