Created
March 22, 2020 06:33
-
-
Save rwilkes/46360f5134b114a1a4bfc9707f166064 to your computer and use it in GitHub Desktop.
ThinkScript: Super Trend
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
| # Mobius | |
| # SuperTrend | |
| # Chat Room Request | |
| input AtrMult = 1.0; | |
| input nATR = 4; | |
| input AvgType = AverageType.HULL; | |
| input PaintBars = yes; | |
| def ATR = MovingAverage(AvgType, TrueRange(high, close, low), nATR); | |
| def UP = HL2 + (AtrMult * ATR); | |
| def DN = HL2 + (-AtrMult * ATR); | |
| def ST = if close < ST[1] then UP else DN; | |
| plot SuperTrend = ST; | |
| SuperTrend.AssignValueColor(if close < ST then Color.RED else Color.GREEN); | |
| AssignPriceColor(if PaintBars and close < ST | |
| then Color.RED | |
| else if PaintBars and close > ST | |
| then Color.GREEN | |
| else Color.CURRENT); | |
| AddChartBubble(close crosses below ST, low[1], low[1], color.Dark_Gray); | |
| AddChartBubble(close crosses above ST, high[1], high[1], color.Dark_Gray, no); | |
| # End Code SuperTrend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment