Help for Supertrend indicator

Hi everybody and good Eastern,

As in PF 123 Supertrend indicator is not supported (while it is in Prorealtime), I’d like to ask a help because I want to try to use this indicator in my Simulation, but I am not good enough to set such a indicator.
I’d like to search stocks (among other criteria) whose Supertrend (eg.3,10) color become green from a previous red.
Can anyone help me in doing this? Here below a couple of articles on how to calculate it.

https://www.tradingfuel.com/supertrend-indicator-formula-and-calculation/
https://www.tickertape.in/blog/supertrend-indicator-formula-and-how-to-use-it-to-identify-buy-and-sell-signals/

Thanks in advance
Fabio

Hi Fabio,

supertrend is a strategy mainly applied by short-term traders who use 1, 5, 10 or 15 min bars to unlock short-term trends. If you want to use it in p123, the limitation is that bars will always be 1 day duration.

As for the implementation in P123, the general approach would be to calculate basic upperband & lowerband, final upperband & lowerband and supertrend as five individual aggregate series. the remaining rules can be implemented with if statements in the buy and sell rules in your model.

Overall I would say that - whilst supertrend is populat for high-frequency trading - it is more difficult to exploit as multi-day strategy. It takes many bars to define a trend, and trends are much more obvious when markets follow a macroeconomic cycle. This is certainly not the case right now, when developments with war, coronavirus and interest rate hikes can make markets swing every week or month.

hth,
Florian

Thank you Florian, to be onest Supertrend can be used in every time frame (I use in free Prorealtime, which works on daily bases).
Anyway I tried to calculate the upperband (and lowerband) but I was stopped at the beginning…I haven’t find the formula to apply to find the highest price of the previous day. :frowning:

The formula for the highest price of the previous day is simply Hi(1) or Hi(0), depending on what you define as “the previous day.”

Basic Upperband = (hi(0) + low(0)) / 2 + multiplier * ATR

The Loop functions may be an alternative to aggregate series.

Thank you Yuval,

Watching Prorealtime Supertrend (3,10), I noticed that lower value calculated as in your formula is more or less the same a Prorealtime, but the upper value is different. If you see eg. TCFC last friday closure (file attached) which just went from red value to green value in Prorealtime, value are 38.21 for lower band (green) and 40.43 for upper band (red). Upper band is calculated the day before.
If I use PF123 formula the lower value is 38.32 (almost the same as Prorealtime) but the upper value is 41.22 which is quite different.
Am I doing something wrong?



I’m afraid I don’t know exactly how Prorealtime is calculating the Supertrend, so I can’t help you there. Your formula appears correct to me.

  • Yuval