StockFetcher Forums · Filter Exchange · Help with (TradingView) Double SuperTrend ATR<< >>Post Follow-up
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,031 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

Cheese
1,374 posts
msg #156694
Ignore Cheese
4/27/2021 3:00:56 PM

Thank you, Ed S
I will take a look.

Cheese
1,374 posts
msg #156695
Ignore Cheese
4/27/2021 5:42:07 PM

Hi Ed

I haven't figured out the nitty gritty of If ...Then ... Else ... to determine the trend
so I did something simpler.

This means we currently have much better ATR-based filters in this forum
than my cockle mania TradingView knock-off below.

LOL

Fetcher[
SYMLIST(XLE,TSLA)
chart-type OHLC
chart-time 4 months

set{1atr12, 1 * atr(12)}

set{HiLo, High + Low}
set{HiLo1, HiLo 1 day ago}
set{HiLo1_avg, 0.5 * HiLo1}
Draw HiLo1_avg on plot price

set{MinusLine1, HiLo1_avg - 1atr12}
/* Draw MinusLine1 on plot price */

set{PlusLine1, HiLo1_avg + 1atr12}
/* Draw PlusLine1 on plot price */

set{TUp, count(close > PlusLine1,1)}
draw TUp

set{TDown, count(close < MinusLine1,1)}
draw TDown
]




StockFetcher Forums · Filter Exchange · Help with (TradingView) Double SuperTrend ATR<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.