I'm using this code as a study:
Can someone help me use this in a scan when Uptrend is true?
Can someone help me use this in a scan when Uptrend is true?
Can someone help me use this in a scan when Uptrend is true?
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2015-2020
#
#wizard plots
#wizard text: Inputs: trend check:
#wizard input: trendCheck
input trendCheck = {Min, Normal, default Max};
input showLabel = yes;
def avg20 = Average(close, 20);
def avg50 = Average(close, 50);
def avg200 = Average(close, 200);
plot Downtrend = close < avg50 and
(if trendCheck != trendCheck.Min then avg20 < avg50 else yes) and
(if trendCheck == trendCheck.Max then avg50 < avg200 else yes);
plot Uptrend = close > avg50 and
(if trendCheck != trendCheck.Min then avg20 > avg50 else yes) and
(if trendCheck == trendCheck.Max then avg50 > avg200 else yes);
Downtrend.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Downtrend.SetLineWeight(3);
Downtrend.SetDefaultColor(Color.DOWNTICK);
Uptrend.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Uptrend.SetLineWeight(3);
Uptrend.SetDefaultColor(Color.UPTICK);
DefineGlobalColor("Downtrend", Color.DOWNTICK);
DefineGlobalColor("Sideways", Color.GRAY);
DefineGlobalColor("Uptrend", Color.UPTICK);
AddLabel(showLabel, if Downtrend then "Downtrend" else if Uptrend then "Uptrend" else "Sideways", if Downtrend then GlobalColor("Downtrend") else if Uptrend then GlobalColor("Uptrend") else GlobalColor("Sideways"));
Can someone help me use this in a scan when Uptrend is true?