Convert SuperTrend chart study to scan


Category:
0
0

hello mr hahn.

can i run a scan like this stock (ALT) where i ca scan where the stock is in the green zone. and also in the red zone

$35 red zone and $11 green zone

Attachments:
Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on September 17, 2020 2:36 am
335 views
0
yes those are price reversals or support and resistance lines. its a study from TOS study called trending(5,.07) is it possible to use that reversal as a scan ? thanks mr. Hanh. i tried to find the code in the study but does not allow.
( at September 17, 2020 7:19 pm)
0
or can i use a 1: scan on the study trending (5,.07)? also another 2: scan using the study hullmovingaverage? thank you again mr Hahn
( at September 17, 2020 7:31 pm)
0
You are mistaken. There is no chart study named "trending" provided with Thinkorswim. That is a custom chart study you added to your account.
( at September 17, 2020 8:23 pm)
0
# 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 this is the code i found for supertrending can i use this as a scan and use it as in my watchlist if it turns green have a value of one and if not zero.. thanks in advance
( at September 17, 2020 10:44 pm)
0
i did use this in my watchlist it shows green or red with a value (price) but can i run a scan when supertrending turns green and when it turns red thank you sir
( at September 17, 2020 10:48 pm)
0
Private answer

The source code should have been provided with the original post and included as a plain text file attached to the question. But at least we managed to get the code provided in the comments section below the question. The problem with this is that code posted in the comment section is stripped of all formatting.

Once you format that code to restore the line breaks after each ";" symbol we end up with 15 lines of code. To convert this to a scan you delete the last 6 lines of code and add the following for the scan signals:

plot scan = close < ST;

plot scan = close > ST;

You can only run one of those signals at a time. The first one returns stocks where the "SuperTrend" is red. The second one returns stocks where it is green.

Marked as spam
Posted by (Questions: 37, Answers: 4079)
Answered on September 18, 2020 8:39 am
0
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); plot Scan = Close < st ; plot SuperTrend = ST; SuperTrend.AssignValueColor(if close < ST then Color.RED else Color.GREEN); AssignPriceColor(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
( at September 20, 2020 12:34 am)