#Follow Ken Rose on twitter @KRose_TDA for updates to this and other custom scripts
# Market Forecast system
# This thinkscript will put red dots on the upper price chart above the corresponding candles when a bearish Market Forecast cluster forms. It will put green dots below the candles when bullish clusters form.
# It is used mostly as a cautionary flag to determine if a stock that we are considering purchasing has legitimate overbought conditions(red dots) at that time.
# Market Forecast system parameters
input showClusters = yes; # Display markers on the chart for cluster patterns
def upper_reversal = 80;
def lower_reversal = 20;
def greenline = reference MarketForecast.intermediate;
def blueline = reference MarketForecast.NearTerm;
def redline = reference MarketForecast.momentum;
#Define bullish and bearish clusters
def BullishCluster = greenline < 20 and redline < 20 and blueline < 20;
def BearishCluster = greenline > 80 and redline > 80 and blueline > 80;
# Plot the bullish clusters as green dots below the day's candle
plot data9 = if showClusters and BullishCluster then low * 0.990 else Double.NaN;
data9.SetPaintingStrategy(PaintingStrategy.POINTS);
data9.SetLineWeight(5);
data9.AssignValueColor(Color.DARK_GREEN);
data9.HideBubble();
data9.HideTitle();
# Plot the bearish clusters as blue dots above the day's candle
plot data10 = if showClusters and BearishCluster then high * 1.01 else Double.NaN;
data10.SetPaintingStrategy(PaintingStrategy.points);
data10.SetLineWeight(5);
data10.AssignValueColor(Color.red);
data10.HideBubble();
data10.HideTitle();
Here is the MarketForecastEnhancedLower study:
#follow @KRose_TDA on twitter for updates to this and other custom studies
declare lower;
input OverBought = 80;
input OverSold = 20;
input Show_Labels = yes;
plot Momentum = MarketForecast();
Momentum.SetDefaultColor(Color.RED);
AddLabel(Show_Labels, "Momentum: " + AsText(Momentum, NumberFormat.TWO_DECIMAL_PLACES), Color.RED);
plot NearTerm = MarketForecast().NearTerm;
NearTerm.SetDefaultColor(Color.BLUE);
AddLabel(Show_Labels, "Near Term: " + AsText(NearTerm, NumberFormat.TWO_DECIMAL_PLACES), color.BLUE);
plot IntTerm = MarketForecast().Intermediate;
IntTerm.SetDefaultColor(CreateColor(51, 204, 0));
AddLabel(Show_Labels, "Intermediate Term: " + AsText(IntTerm, NumberFormat.TWO_DECIMAL_PLACES), (CreateColor(51, 204, 0)));
plot OB_line = OverBought;
OB_line.SetDefaultColor(Color.RED);
OB_line.SetLineWeight(2);
plot OS_line = OverSold;
OS_line.SetDefaultColor(Color.GREEN);
OS_line.SetLineWeight(2);
AddCloud(0, OS_line, Color.GREEN, Color.GREEN);
AddCloud(100, OB_line, Color.RED, Color.RED);
Here is the SCAN script:
MarketForecast()."Momentum" is greater than or equal to 80.00 and MarketForecast()."NearTerm" is greater than or equal to 80.00 and MarketForecast()."Intermediate" is greater than or equal to 80.00 or MarketForecast()."Momentum" is less than or equal to 20.00 and MarketForecast()."NearTerm" is less than or equal to 20.00 and MarketForecast()."Intermediate" is less than or equal to 20.00