Advanced Market Forecast Indicator & Scanner for ThinkorSwim

Madhu

Member
VIP
@PATrader Please look at my comment and screenshot again in message #41.

I used the same thing I posted on the first page of this thread....except each condition belongs to one separate scanner.

Old scan:

Code:
MarketForecast()."Momentum" crosses above MarketForecast()."NearTerm" and MarketForecast()."NearTerm" crosses above MarketForecast()."Intermediate"

New scan:

Code:
MarketForecast()."Momentum" crosses above MarketForecast()."NearTerm"

Code:
MarketForecast()."NearTerm" crosses above MarketForecast()."Intermediate"
Hi Ben,

I was able to add these below two scans, Can you please answer my below questions:


Code:
MarketForecast()."Momentum" crosses above MarketForecast()."NearTerm"
--- Is it for Bullish or Bearish? If I understood correctly from first page, I need to check If red line crosses above the Blue line-- please confirm?

Code:
MarketForecast()."NearTerm" crosses above MarketForecast()."Intermediate"
--- Is it for Bullish or Bearish? If I understood correctly from first page,I need to check If Blue line crosses above the Green line-- please confirm?

Some basic information is missing .
 

stormy77

New member
Hello Ben 10,
Being new here, I am working on the coding. I followed your code and did replace MarketForecast with my name MarketForecast2 and it gives me an error saying can not find the function
What do I need to do
Thanks for any help
Miami51961
Instead of a market forecast, is there a way to make this into a forecast of the underlying?
 

ktp

New member
Instead of a market forecast, is there a way to make this into a forecast of the underlying?
The name is kind of miss leading. This uses the underlying security's price action only so it tell how the security is doing not the entire market. Hope that helps.
 

ianmitch

New member
Could you tell me what other conditions work in combination with this scanner? I'm new to working with this program, so I'm just learning.
To be honest, I haven't been working in the financial sector for a long time, heh. I had to change my profile after the company I worked for closed down. And in the current company, businesses switch from one CRM to another. So you have to learn everything at once, lol. But thanks to one agency, it has become much easier for employees.

By the way, I would like to clarify one more point. Do you have to have coding skills to work successfully in this program? I will be grateful for any advice!
 
Last edited:

rad14733

Well-known member
VIP
Could you tell me what other conditions work in combination with this scanner? I'm new to working with this program, so I'm just learning.

@ianmitch Welcome to the usethinkscript forums... You can add any available filters to further narrow your search, whether price range, volume, etc... The scanners are quite flexible... Experiment... You can't break anything by testing...
 

TOSUser21

New member
TOS has a Study called MarketForecast. Is it possible to add this Study as columns in a Watch List?

Thank you in advance for any feedback!
 

Financial Jim

New member
@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);
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.
This script is badass. I'm using it with RSI, MACD, and Standard Deviation Channels and it is really helping analysis and forecasting. Thank you.
 

Similar threads

Top