Last active
October 17, 2021 05:28
-
-
Save marketcalls/7752fc46a3095abcd3bf to your computer and use it in GitHub Desktop.
Pine Script for Supertrend
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| study("Supertrend Marketcalls", overlay = true) | |
| Factor=input(4, minval=1,maxval = 100) | |
| Pd=input(10, minval=1,maxval = 100) | |
| Up=hl2-(Factor*atr(Pd)) | |
| Dn=hl2+(Factor*atr(Pd)) | |
| TrendUp=close[1]>TrendUp[1]? max(Up,TrendUp[1]) : Up | |
| TrendDown=close[1]<TrendDown[1]? min(Dn,TrendDown[1]) : Dn | |
| Trend = close > TrendDown[1] ? 1: close< TrendUp[1]? -1: nz(Trend[1],1) | |
| Tsl = Trend==1? TrendUp: TrendDown | |
| linecolor = Trend == 1 ? green : red | |
| plot(Tsl, color = linecolor , style = line , linewidth = 2,title = "SuperTrend") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
which Version