| Cheese 1,374 posts
 msg #156691
 - Ignore Cheese
 | 4/27/2021 1:25:19 PM 
 Hi everyone,
 
 Would someone be able to write a Stockfetcher filter for the following TradingView indicator?
 
 If that's too much to ask, then would you be able to translate the TradingView code
 to plain English or to some kind of pseudo code ?
 
 I'm only looking for the formula or logic to build the indicator, not the pretty color changes
 of TradingView.
 
 Thank you kindly.
 _______________________________________________________________________
 
 Double SuperTrend ATR
 NomadandTrader
 Aug 23, 2016
 
 
 //Crée par J.Dow
 //Double SuperTrend ATR, Le type ATR calcule la volatilité à partir de l'Average True Range (ATR), il est idéal pour le FOREX
 
 study(title = "Double SuperTrend ATR", shorttitle = "Double SuperTrend ATR", overlay = true)
 
 //Mode
 Factor=input(title="Super Trend", defval=3, minval=1,maxval = 100)
 ATR=input(title="ATR", defval=12, minval=1,maxval = 100)
 
 
 //Super Trend ATR 1
 Up=hl2-(Factor*atr(ATR))
 Dn=hl2+(Factor*atr(ATR))
 
 TUp=close[1]>TUp[1]? max(Up,TUp[1]) : Up
 TDown=close[1]
 Trend = close > TDown[1] ? 1: close< TUp[1]? -1: nz(Trend[1],1)
 
 Tsl1 = Trend==1? TUp: TDown
 Tsl2 = Trend==1? TDown: TUp
 
 linecolor = Trend == 1 ? green : red
 
 //Affichage
 P1 = plot(Tsl1, color = linecolor , style = line , linewidth = 1,title = "SuperTrend ATR-1")
 P2 = plot(Tsl2, color = linecolor , style = line , linewidth = 1,title = "SuperTrend ATR-2")
 fill(P1, P2, color = linecolor == red ? red : green)
 
 
 
 
 
 
 | 
| nibor100 1,099 posts
 msg #156693
 - Ignore nibor100
 | 4/27/2021 2:39:27 PM 
 @cheese,
 
 If you do a SF search on Pine Script you should get one result where there was a similar Supertrend indicator question related to Trading View that I provided some help on that should have enough clues for you to parse out the logic of this one.
 
 If you work on it for a while and don't get the logic all figured out, let me know and I'll go thru it line by line later tonight.
 
 Thanks,
 Ed S.
 
 PS the Trading View Pine Script manual online is fairly easy to look thru for commands and syntax stuff
 
 
 |