Advanced Market Forecast Indicator & Scanner for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
The Advanced Market Forecast indicator is a powerful tool that offers near term trend, intermediate, and momentum oscillator for ThinkorSwim. Similar to RSI and MFI, there will be levels of overbought and oversold. When the stock reaches these levels with the right confirmation, traders can expect a pullback or reversal.

There will be a scanner at the end of this post to help you scan for bullish and bearish signals produced by the Advanced Market Forecast indicator.

oxpSbjI.png


Notes:
  • Green line = Intermediate Confirmation Signal
  • Dark blue = Near term line
  • Red = Momentum
You can also draw divergences using the blue near term line just like the MACD and RSI indicators.

thinkScript Code

Rich (BB code):
#Name: Dilbert_StanL_MarketForecast_TMF_original
#StudyName: Dilbert_StanL_MarketForecast_TMF_original
#Description: Replica of Investools MarketForecast study
#Author: Dilbert/Stanl/Mobius and assorted others you tried to crack this
#Requested By:
# Ver     Date     Auth      Change
# v2      012817   Dilbert   Finally calculate the momentum line correctly. Scale to 100 instead of 200.
# TOS.mx Link:
# Trading Notes:

# Market Forecast
# StanL
#
#hint:<b>Market Forecast</b>modified with upper and lower reversal zones and labels. Is a double-scale version of the original. All plots maintain their relation with 2X scale.

declare lower;
input ImedLength = 31; # orig std = 31
input MomentumLength = 5; # orig std = 31
input NearLength = 3; # orig std = 3

  def c1I = close - lowest(low,ImedLength);
   def c2I = highest(high,ImedLength) - lowest(low,ImedLength);
   def FastK_I = c1I / c2I * 100;
   def c1N = close - lowest(low,NearLength);
   def c2N = highest(high,NearLength) - lowest(low,NearLength);
   def FastK_N = c1N / c2N * 100;

   def c1M = close - lowest(low,MomentumLength);
   def c2M = highest(high,MomentumLength) - lowest(low,MomentumLength);
   def FastK_M = c1M / c2M * 100;
  Plot Intermediate = Average(FastK_I, 5); #  = TMF's GreenLine
     Intermediate.AssignValueColor(color.Green);
     Intermediate.SetStyle(Curve.FIRM);
     Intermediate.SetLineWeight(2);
   Plot NearTerm = Average(FastK_N, 2);     #  = TMF's BlueLine
     NearTerm.AssignValueColor(color.Blue);
     NearTerm.SetStyle(Curve.FIRM);
     NearTerm.SetLineWeight(1);

def Min1 = Min(low, low[1]);
def Min2 = Min(min1, Min(low[2], low[3]));
def Max1 = Max(high, Max(high[1], Max(high[2], high[3])));

plot momentum = ((close - Min1) / (Max1 - Min2)) * 100;
momentum.setDefaultColor(Color.Red);

plot bottomline = 0;
     bottomline.AssignValueColor(color.gray);
     bottomline.SetStyle(Curve.FIRM);

plot topLine = 100;
     topLine.AssignValueColor(color.gray);
     topLine.SetStyle(Curve.FIRM);

plot UpperRevZone = 80;
     bottomline.AssignValueColor(color.gray);
     bottomline.SetStyle(Curve.FIRM);

plot LowerRevZone = 20;
     LowerRevZone.AssignValueColor(color.gray);
     LowerRevZone.SetStyle(Curve.firm);
plot UpLimit = 120;
     UpLimit.AssignValueColor(color.black);

AddCloud(bottomline, LowerRevZone, color.green, Color.green);
AddCloud(topLine, UpperRevZone, color.RED, color.red);
AddLabel (yes, "Mom(short)", Color.yellow);
AddLabel (yes, "Near term", Color.red);
AddLabel (yes, "Med term", Color.green);

# Below lines are related to a scan
#   def ClusterHigh = Intermediate >= 80 && NearTerm >= 80 && Momentum >= 80 ;
#   def ClusterLow = Intermediate <= 20 && NearTerm <= 20 && Momentum <= 20;
#   plot cluster = if clusterhigh or clusterlow then 1 else 0;
#---------- End Of Code ---------------

Shareable Link: https://tos.mx/x1ssTZ

Market Forecast Bullish Scanner
Rich (BB code):
MarketForecast()."Momentum" crosses above MarketForecast()."NearTerm" and MarketForecast()."NearTerm" crosses above MarketForecast()."Intermediate"

Market Forecast Bearish Scanner
Rich (BB code):
MarketForecast()."Momentum" crosses below MarketForecast()."NearTerm" and MarketForecast()."NearTerm" crosses below MarketForecast()."Intermediate"

Don't forget to replace MarketForecast with the name of your indicator.
 

Attachments

  • oxpSbjI.png
    oxpSbjI.png
    323.9 KB · Views: 548
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

I use the Market Forecast Daily, as a Main study for my success in trading. But I dont use the same way it is listed here. I have addition levels that are more Important. the 80 and 20 lines are just a Visual warning for me and dont provide great importance over all. I use a 30 50 70 Line as these are very Important to trend and taking trades. I use a two time frame approach, a daily chart, with a 5minute chart combination. Lets say I see that NG is either close to, or showing a setup on the daily. This Daily setup would be currently, Green Intermediate Line is above the 30 50 70, I then look at the Blue Near line and Red Momo Line, with the Inter Line High which is Bullish, I wait for the red momo and Blue Near to get Oversold under 20 and come back up to break 30 line this is when, I then start looking at the 5min for trade entries, using a REDSAR .01.05 breakout, and 30High/Low Breaking the High. and staying above it till a GoldSAR .02 .20 is Broken, Once the Daily setup starts I keep taken trades based on the 5min till it no longer breaks out, and or the Daily Red& Blue Lines get up to the 70 to 80 line, then I wait for another daily setup. I trade all Futures this way, and stocks. I have been doing it this way for years. I would Like to see if I can get it a Little more automated though.

I have some code I found a while back that uses the MF Info and provide Vertical lines for it, it is Not exactly how I want it but it is close.
Code:
##############################################################################################
# aaa_BVZ_MFC_Clusters_on_Chart - 8/21/2018 Developed by G. Horschman ([email protected])
##############################################################################################
# This script will work on any chart.  However, it was designed to work in conjunction
# with the Market Scholars Mkt Forecast Posture Script. It can be used to display
# and identify the following signals on the chart:
#
# a) Mkt Forecast Bullish and Bearish Clusters
# b) Mkt Forecast Intermediate Confirmation Signals
# c) Stochastic overbought and oversold signals - K=7,D=3 periods work really well.
# A bullish oversold up-arrow will appear when the "K" line crosses up through the
# "D" line and the "K" line is below the oversold level (25). A bearish overbought
# down-arrow will appear when the "K" line crossed down through the "D" line and
# the "K" line is above the overbought level.
# d) Mkt Forecast Posture in a chart label.
# e) 10 day EMA trend changes
#
# The script can also be used with alert signals to look for conditional setups. All
# indicators can easily be turned or off at will, as what may be appropriate for one symbol
# may not be suitable for others.

DefineGlobalColor("UpArrow", CreateColor(35, 255, 106));
DefineGlobalColor("DownArrow", CreateColor(255, 14, 20));
input ShowIntermediateConfirms = yes;
input ShowMfcClusters = yes;
input ShowStoArrows = yes;
input ShowIntermediateLabel = no;
input Show10DayMovingAvg = no;
def price = close;
def MA30 = SimpleMovingAvg(price = close, length = 30);
def EMA_10day = ExpAverage(close, length = 10);
def MFC = reference MarketForecast.intermediate;
def MFCRising = if MFC >= MFC[1] then 1 else 0;
def MFCPosture = if (MFC > 80) or (MFC > 20 and MFCRising) then 1 else 0;
def MFCURZ = if MFC > 80 then 1 else 0;
def mfcNearTerm = reference MarketForecast.nearterm;
def mfcMomentum = reference MarketForecast.momentum;
def BullishCluster = if MFC < 20 and mfcNearTerm < 20 and mfcMomentum < 20 then 1 else 0;
def BearishCluster = if MFC > 80 and mfcNearTerm > 80 and mfcMomentum > 80 then 1 else 0;
# Plot Clusters on the chart
plot bullDot = if BullishCluster and ShowMfcClusters then low * .996 else Double.NaN;
bullDot.SetStyle(Curve.POINTS);
bullDot.SetLineWeight(5);
bullDot.SetDefaultColor(Color.GREEN);
bullDot.HideBubble();
plot bearDot = if BearishCluster and ShowMfcClusters then high * 1.004 else Double.NaN;
bearDot.SetStyle(Curve.POINTS);
bearDot.SetLineWeight(5);
bearDot.SetDefaultColor(Color.RED);
bearDot.HideBubble();
# Bullish Intermediate Confirmation
def IntermediateConfirmation_Major = if MFCURZ
and mfcMomentum < 20 and mfcMomentum > 5
       and mfcNearTerm > 20 and mfcNearTerm < 50 then 1 else 0;
plot IC_major = if ShowIntermediateConfirms and IntermediateConfirmation_Major then MA30 * .99 else Double.NaN;
IC_major.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
IC_major.SetLineWeight(5);
IC_major.AssignValueColor(Color.DARK_ORANGE);
def IntermediateConfirmation_Minor = if MFCURZ
and mfcMomentum < 20 and mfcMomentum > 5
and !(mfcNearTerm > 20 and mfcNearTerm < 50) then 1 else 0;
plot IC_minor = if ShowIntermediateConfirms and IntermediateConfirmation_Minor then MA30 * .99 else Double.NaN;
IC_minor.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
IC_minor.SetLineWeight(2);
IC_minor.AssignValueColor(Color.DARK_ORANGE);
AddLabel (ShowIntermediateLabel, "MFC " + Round(MFC) + " " + if MFCRising then "rising" else "falling", if MFCPosture then Color.GREEN else GlobalColor("DownArrow"));
# +++++++ Show Stochastic Reversals on Chart +++++++++++
def over_bought = 75;
def over_sold = 25;
def KPeriod = 7;
def DPeriod = 3;
def priceH = high;
def priceL = low;
def priceC = close;
def average = AverageType.SIMPLE;

def SlowK = reference StochasticSlow(over_bought,
over_sold,
KPeriod,
DPeriod,
priceH,
priceL,
                                      priceC, AverageType.SIMPLE).SlowK;
def SlowD = reference  StochasticSlow(over_bought, 
over_sold,
KPeriod,
DPeriod,
priceH,
priceL,
                                      priceC, AverageType.SIMPLE).SlowD;
plot stoUp = if (ShowStoArrows and
SlowK >= SlowD and
SlowK[1] < SlowD[1]) and
                 SlowK[1] < over_sold then low * .8 else Double.NaN;
plot stoDn = if (ShowStoArrows and
SlowK <= SlowD and
SlowK[1] > SlowD[1]) and
                 SlowK[1] > over_bought then high * 1.2 else Double.NaN;
stoUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
stoUp.SetLineWeight(3);
stoUp.SetDefaultColor(Color.YELLOW);
stoDn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
stoDn.SetLineWeight(3);
stoDn.SetDefaultColor(Color.YELLOW);

# Plot 10-day EMA Trend Changes
def v_EMA10_up = if EMA_10day > EMA_10day[1] and EMA_10day[1] < EMA_10day[2] then 1 else 0;
def v_EMA10_down = if  EMA_10day < EMA_10day[1] and EMA_10day[1] > EMA_10day[2] then 1 else 0;

plot EMA10_up = if v_EMA10_up and Show10DayMovingAvg then EMA_10day else double.Nan;
plot EMA10_down = if v_EMA10_down and Show10DayMovingAvg then EMA_10day else double.Nan;
EMA10_up.SetPaintingStrategy(PaintingStrategy.POINTS);
EMA10_up.SetDefaultColor(color.GREEN);
EMA10_up.SetLineWeight(3);
EMA10_down.SetPaintingStrategy(PaintingStrategy.POINTS);
EMA10_down.SetDefaultColor(color.RED);
EMA10_down.SetLineWeight(3);

I would Like to see the above script draw a Vertical Line it already does this I would like it a little different, based off of the MF Blue Near and RED momo Lines breaking the 30 displaying a Green Vertical Line and or the Blue Near and Red momo breaking down through the 70 to produce a Red Vertical line. It would be Much better if it could display these or separate lines that could be turned on/off when Green Intermediate Line was either in a Positive trend (above 30 50 70 from a Below 20 condition) or a Negative trend (Below 70 50 30 off of a above 80 condition) alerts would also be Great.

I use the Longer time frames to tell me where the Trend starts and finishes, or continues, Coming Out of a timing Low can usually have a Velocity up move, going into a Timing Low can have a Velocity move Down into the timing Low. The SAR Breaks tell me when a Support and resistance is broken, with the Candle immediately after a RedSar Break, is an Important Level, price needs to get past that level, Cycle timing tell me where the changes are, If there is No real pull down into a Low, and you get a Higher low then next high will be a Higher high, and that tells me where the Lows will be this tells me where the Velocity down into the next timing low will occur, and the New timing start will occur for up Velocity will start. I look for timing starts and finishes, Based on cycle timing, I use the SARs based on my SAR timing to tell me when a SAR (SAR + Support and Resistance) is Important to the next trend. So lest say we see a timing Low based on a cycle band occurs and price crosses to the cycle start, you have a Potential setup occurring, then I would look at the Market Forecast or MF to show me what to do next. Lets say you missed Most of the last trend up for what ever reason, When the Price Breaks the GoldSar, this is a Early Warning of either a Trend Change, or a Choppy condition is about to occur. When I Look for these moves on a Daily chart, I will take the trades on a 5 Minute chart, using same sequences. But I now have the trend timing and important support and resistance levels. I chart picture would be important for me to explain the Market Forecast 20-30-50-70-80 Lines

Looking for a New Trend on Daily chart or Weekly Chart, to establish the Longer trend is Important, as this will tell you What side of the trades will have the Largest Moves, so if the trend is UP on the weekly and daily, then I want to only be looking for Up moves on the Shorter intraday charts, Unless you have a unlaying that is very good at provide two sided trading, into Cycle timing Lows on a Up trend. The Market Forecast, Lets say the MF Green Inter Line is was Below the 20 line and Now has Moved Above 50 line, this is a Bullish Trend, with the Green line High (>50) I would be Looking at the Blue Near Line and the Red Momentum or Momo Line to get back down to 20 as this is a Oversold condition with a Green line above 50 for Trend UP this would be a Good Entry Tell With Green line High, and Blue and Red Getting Oversold at 30 or 20 or lower, when the red and blue come back up to above 20 or 30 line that is the Entry. I tried to paste a chart picture for you that I marked up, But it wont let me paste it. It keeps saying stop correcting. Sorry

I have a watch list that I have made for my style of trading, that shows the Daily Green in one column breaks 50 line and Blue Breaks in one Column the 50 line, and Intraday columns with a short side and a Long side, My watchlist tells when the setup is close to or has occured.

I am looking to Automate this strategy a Little more. Right now I put a Alert at where the REDSAR Breaks, and Post Candle High/Low depending on trend direction gets taken out, and GoldSAR Breaks, so I know when the Longer term trend has either started or has Finished. As this tells me when I should be taking trades, or Not taking trades, when a Trend is established, or coming to an end, or when it is Choppy, and to stay out.

When I say Velocity, Into and Out of a cycle. I am referring to How much Movement Velocity of move or speed of Move Down into a Cycle Timing Low. Or the Velocity speed Moving Up Out of a New Cycle Start. When I look at cycle timing, lets use a New Cycle start, for instance, if I get a Good Move up out of a New timing cycle, and it shows it has good velocity right from the start this tells me that I have a Good trend that is strong or good velocity. But If I take the same cycle Timing start, and it does Not move up Out of a Brand new cycle start with Any velocity, but in fact each consecutive candles is the same for a couple/ few candles this tells me we may be in a Choppy sideways condition. I would be looking for something that is performing better off of a New cycle. I watch Most all Futures on my watchlist. I am also watching all FAANNG stocks + MSFT Plus Gold stocks and Gold Miners, Silver Miners, Drillers, and all Currencies. I watch these daily, I do this for a Living everyday, as it is my job/career, I Must have an edge to be able to see what is Hot or near Hot, and What Is Not worth Looking at, as my time is very valuable and it must be used Very wisely.
 
Last edited by a moderator:
HI, The two magenta colored lines in the chart, does it mean anything?

 
Last edited:
@GeneHo Oh, the two lines on the upper chart were my Support and Resistance lines, drawn manually.

 
Last edited:
@GeneHo

Code:
Declare Lower;

input OverBought = 70;
input OverSold = 30;
input Middle = 50;

plot Momentum = marketForecast();
Momentum.setDefaultColor(color.RED);
AddLabel(yes, "Momentum: " + AsText(Momentum, NumberFormat.TWO_DECIMAL_PLACES) + (if marketForecast() > marketForecast()[1] then "  rising" else if marketForecast() < marketForecast()[1] then "  falling" else ""), color.RED);

plot NearTerm = MarketForecast().NearTerm;
NearTerm.setDefaultColor(color.BLUE);
AddLabel(yes, "Near Term: " + AsText(NearTerm, NumberFormat.TWO_DECIMAL_PLACES) + (if marketForecast().NearTerm > marketForecast().NearTerm[1] then "  rising" else if marketForecast().NearTerm < marketForecast().NearTerm[1] then "  falling" else ""), color.BLUE);


plot IntTerm = MarketForecast().Intermediate;
IntTerm.setDefaultColor(createColor(51, 204, 0));
AddLabel(yes, "(IT)-Intermediate Term: " + AsText(IntTerm, NumberFormat.TWO_DECIMAL_PLACES) + (if marketForecast().Intermediate > marketForecast().Intermediate[1] then "  rising" else if marketForecast().Intermediate < marketForecast().Intermediate[1] then "  falling" else ""),(createColor(51,204,0)));


plot OB_line = OverBought;
OB_line.setdefaultColor(color.Green);
OB_line.setLineWeight(2);

plot OS_line = OverSold;
OS_line.setdefaultColor(color.Red);
OS_line.setLineWeight(2);

plot Middle_Line = Middle;
Middle_line.setdefaultColor(color.White);
Middle_line.setLineWeight(2);

plot cluster2=if momentum>overbought && NearTerm>overbought then 100 else if momentum<oversold && NearTerm<oversold then 0 else double.nan;
cluster2.setpaintingStrategy(paintingStrategy.POINTS);
cluster2.defineColor("bearish", color.yellow);
cluster2.defineColor("bullish", color.blue);
cluster2.assignValueColor(if !isnaN(cluster2) && cluster2==100 then cluster2.color("bearish")else cluster2.color("bullish"));
cluster2.setlineWeight(2);
cluster2.hideBubble();
def formingBar2=!isnaN(close)&&isnan(close[-1]);
plot zed2=if barNumber()%10 == 0 && !formingBar2 then 0 else double.NaN;
zed2.setDefaultColor(color.light_GRAY);
zed2.hideBubble();
plot uno2=if barNumber()%10 ==0 && !formingBar2 then 105 else double.nan;
uno2.setdefaultColor(color.light_gray);
uno2.hidebubble();

AddCloud(0, OS_line, color.Yellow, Color.YELLOW);
AddCloud(100, OB_line, color.Green, color.Green);
AddCloud(30, Middle_line, color.Red, color.Red);

#################################################

input OverBought1 = 80;
input OverSold1 = 20;
input Middle1 = 50;


plot OB_line1 = OverBought1;
OB_line.setdefaultColor(color.Green);
OB_line.setLineWeight(2);

plot OS_line1 = OverSold1;
OS_line.setdefaultColor(color.Red);
OS_line.setLineWeight(2);

plot Middle_Line1 = Middle1;
Middle_line.setdefaultColor(color.White);
Middle_line.setLineWeight(2);
###############

plot cluster=if momentum>overbought1 && NearTerm>overbought1 && intTerm> overbought1 then 100 else if momentum<oversold1 && NearTerm<oversold1 && intTerm<oversold1 then 0 else double.nan;
cluster.setpaintingStrategy(paintingStrategy.POINTS);
cluster.defineColor("bearish", color.red);
cluster.defineColor("bullish", color.green);
cluster.assignValueColor(if !isnaN(cluster) && cluster==100 then cluster.color("bearish")else cluster.color("bullish"));
cluster.setlineWeight(5);
cluster.hideBubble();
def formingBar=!isnaN(close)&&isnan(close[-1]);
plot zed=if barNumber()%10 == 0 && !formingBar then 0 else double.NaN;
zed.setDefaultColor(color.light_GRAY);
zed.hideBubble();
plot uno=if barNumber()%10 ==0 && !formingBar then 105 else double.nan;
uno.setdefaultColor(color.light_gray);
uno.hidebubble();
########


def BullCluster = momentum <=20 and intTerm <=20 and Nearterm <=20;
def BearCluster = momentum >=80 and intTerm >=80 and Nearterm >=80;

#addlabel(yes, "IT*Above 80 - Intrmdt Trade",color.DARK_Green);
#addlabel(yes, "IT*Below 80 - Defensive",color.YELLOW);
#addlabel(yes, "IT*Below 50 - BEARISH",color.DARK_RED);
#addlabel(yes, "IT*Below 20 Then Crosses above 20 - Bullish",Color.UPTICK);
 
I added the following lines and it serve my need: though it is not very nice

Rich (BB code):
def BullCluster = momentum <=20 and intermediate <=20 and nearterm <=20;
def BearCluster = momentum >=80 and intermediate >=80 and nearterm >=80;
AddVerticalLine(Bullcluster , "Up", Color.UPTICK);
AddVerticalLine(BearCluster , "Down", Color.LIGHT_RED);
pls advise where to add the lines? I tried but fail to work
 
That is an excellent version of the Market Forecast indicator. I have found it very useful. Thanks for posting it, Moose.
This is the upper study, will show you the major market bottoms. I usually use it on daily and weekly HeikinAshi chart. you can make a scanner based on the arrows.

Code:
input LowLevel = 20;
input HighLevel = 80;

def Intermediate = reference marketforecast.Intermediate;
def NearTerm = reference marketforecast.NearTerm;
def Momentum = reference marketforecast.Momentum;
def ClusterHigh = Intermediate>=HighLevel && NearTerm>=HighLevel && Momentum>=HighLevel ;
def ClusterLow = Intermediate<=LowLevel && NearTerm<=LowLevel && Momentum<=LowLevel;

plot cluster = clusterhigh or clusterlow;
Plot Cluster_HiSignal = !clusterhigh and clusterhigh[1];
plot Cluster_LoSignal = !clusterlow and clusterlow[1];


cluster.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Cluster_HiSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Cluster_LoSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
cluster.setLineWeight(5);
cluster_HiSignal.setLineWeight(5);
cluster_LoSignal.setLineWeight(5);

cluster_HiSignal.SetDefaultColor(color.Red);
cluster_LoSignal.SetDefaultColor(color.Green);
Cluster.AssignValueColor(if ClusterHigh then color.Red else color.Green);

Alert(cluster,"Market Forecast Cluster",alert.Once,Sound.Bell);
 
@Moose
Outstanding. That gives a lot of great signals and shows them clearly. The MF indicator is one of the best ones available, in my opinion. Thank you, Moose.

I'll check out those heikin Ashi candles. I've used regular candles for years but haven't yet delved into the other varieties of candlesticks.
 
Last edited:
TOS MarketForecast()."Intermediate" Label

I use the TOS MarketForecast()."Intermediate" to indicate trend direction and strength.
Can use as a lower study indicator and label or eliminate the lower study and keep the label in the upper-chart, by dragging it to the upper chart and un-plotting the lines by clicking on the gear and unchecking 'show plot'.

aKCL5LG.png


Here is the shared chart: https://tos.mx/omqBpCU

Explanation of colors:
if Intermediate>= 80 then "Bull" color cyan
if Intermediate<= 20 then "Bear" color red
if Intermediate>previous candle then "Rising" color green
if Intermediate<previous candle then "Falling" color pink

You can read more about this indicator here
 
I don't see anything better than simple accumulation momentum right now and this definitely shows when momo is slowing
 
Last edited:
TOS MarketForecast()."Intermediate" Label

I use the TOS MarketForecast()."Intermediate" to indicate trend direction and strength.
Can use as a lower study indicator and label or eliminate the lower study and keep the label in the upper-chart, by dragging it to the upper chart and un-plotting the lines by clicking on the gear and unchecking 'show plot'.

aKCL5LG.png


Here is the shared chart: https://tos.mx/omqBpCU

Explanation of colors:
if Intermediate>= 80 then "Bull" color cyan
if Intermediate<= 20 then "Bear" color red
if Intermediate>previous candle then "Rising" color green
if Intermediate<previous candle then "Falling" color pink

You can read more about this indicator here
great jobs
 
The Advanced Market Forecast indicator is a powerful tool that offers near term trend, intermediate, and momentum oscillator for ThinkorSwim. Similar to RSI and MFI, there will be levels of overbought and oversold. When the stock reaches these levels with the right confirmation, traders can expect a pullback or reversal.

There will be a scanner at the end of this post to help you scan for bullish and bearish signals produced by the Advanced Market Forecast indicator.

oxpSbjI.png


Notes:
  • Green line = Intermediate Confirmation Signal
  • Dark blue = Near term line
  • Red = Momentum
You can also draw divergences using the blue near term line just like the MACD and RSI indicators.

thinkScript Code

Rich (BB code):
#Name: Dilbert_StanL_MarketForecast_TMF_original
#StudyName: Dilbert_StanL_MarketForecast_TMF_original
#Description: Replica of Investools MarketForecast study
#Author: Dilbert/Stanl/Mobius and assorted others you tried to crack this
#Requested By:
# Ver     Date     Auth      Change
# v2      012817   Dilbert   Finally calculate the momentum line correctly. Scale to 100 instead of 200.
# TOS.mx Link:
# Trading Notes:

# Market Forecast
# StanL
#
#hint:<b>Market Forecast</b>modified with upper and lower reversal zones and labels. Is a double-scale version of the original. All plots maintain their relation with 2X scale.

declare lower;
input ImedLength = 31; # orig std = 31
input MomentumLength = 5; # orig std = 31
input NearLength = 3; # orig std = 3

  def c1I = close - lowest(low,ImedLength);
   def c2I = highest(high,ImedLength) - lowest(low,ImedLength);
   def FastK_I = c1I / c2I * 100;
   def c1N = close - lowest(low,NearLength);
   def c2N = highest(high,NearLength) - lowest(low,NearLength);
   def FastK_N = c1N / c2N * 100;

   def c1M = close - lowest(low,MomentumLength);
   def c2M = highest(high,MomentumLength) - lowest(low,MomentumLength);
   def FastK_M = c1M / c2M * 100;
  Plot Intermediate = Average(FastK_I, 5); #  = TMF's GreenLine
     Intermediate.AssignValueColor(color.Green);
     Intermediate.SetStyle(Curve.FIRM);
     Intermediate.SetLineWeight(2);
   Plot NearTerm = Average(FastK_N, 2);     #  = TMF's BlueLine
     NearTerm.AssignValueColor(color.Blue);
     NearTerm.SetStyle(Curve.FIRM);
     NearTerm.SetLineWeight(1);

def Min1 = Min(low, low[1]);
def Min2 = Min(min1, Min(low[2], low[3]));
def Max1 = Max(high, Max(high[1], Max(high[2], high[3])));

plot momentum = ((close - Min1) / (Max1 - Min2)) * 100;
momentum.setDefaultColor(Color.Red);

plot bottomline = 0;
     bottomline.AssignValueColor(color.gray);
     bottomline.SetStyle(Curve.FIRM);

plot topLine = 100;
     topLine.AssignValueColor(color.gray);
     topLine.SetStyle(Curve.FIRM);

plot UpperRevZone = 80;
     bottomline.AssignValueColor(color.gray);
     bottomline.SetStyle(Curve.FIRM);

plot LowerRevZone = 20;
     LowerRevZone.AssignValueColor(color.gray);
     LowerRevZone.SetStyle(Curve.firm);
plot UpLimit = 120;
     UpLimit.AssignValueColor(color.black);

AddCloud(bottomline, LowerRevZone, color.green, Color.green);
AddCloud(topLine, UpperRevZone, color.RED, color.red);
AddLabel (yes, "Mom(short)", Color.yellow);
AddLabel (yes, "Near term", Color.red);
AddLabel (yes, "Med term", Color.green);

# Below lines are related to a scan
#   def ClusterHigh = Intermediate >= 80 && NearTerm >= 80 && Momentum >= 80 ;
#   def ClusterLow = Intermediate <= 20 && NearTerm <= 20 && Momentum <= 20;
#   plot cluster = if clusterhigh or clusterlow then 1 else 0;
#---------- End Of Code ---------------

Shareable Link: https://tos.mx/x1ssTZ

Market Forecast Bullish Scanner
Rich (BB code):
MarketForecast()."Momentum" crosses above MarketForecast()."NearTerm" and MarketForecast()."NearTerm" crosses above MarketForecast()."Intermediate"

Market Forecast Bearish Scanner
Rich (BB code):
MarketForecast()."Momentum" crosses below MarketForecast()."NearTerm" and MarketForecast()."NearTerm" crosses below MarketForecast()."Intermediate"

Don't forget to replace MarketForecast with the name of your indicator.
When I enter the second "Near Term" do I save it first and enter it again?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
497 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top