The Stock Market Crash Indicator

Picard

Member
There's a The Stock Market Crash Indicator for TradeStation and I'm wondering if someone in this forum can translate this into ThinkScript? Watch This Video

Code:
Inputs:        WarningColor(White), CorrectionColor(Red), CrashColor(Red);
Variables:    CommLong(0), CommShort(0), TotalOI(0), WarningSetUp(0), CorrectionSetUp(False), CrashSetUp(False), HighestHigh52(C);

CommLong = GetFundData("COTF-12",0);
CommShort = GetFundData("COTF-13",0);
TotalOI = GetFundData("COTF-8",0);

If TotalOI <> 0 then Value1 = (CommLong-CommShort)/TotalOI*100;

If H = Highest(H,52) and Value1 < 0 and WarningSetup = 0 then WarningSetup = 1;
If WarningSetup = 1 and Value1 > 0 then WarningSetup = 2;
If WarningSetup = 2 and Value1 < 0 then begin
    WarningSetUp = 0;
    Plot1(H,"Warning",WarningColor);
    Value91 = Text_New(D,T,H,"Warning  ");
    Value92 = Text_SetColor(Value91,WarningColor);
    Value93 = Text_SetStyle(Value91,1,2);
End;

If H = Highest(H,52) then begin
    CorrectionSetUp = True;
    CrashSetUp = True;
    HighestHigh52 = H;
End;
If CorrectionSetUp and L <= HighestHigh52*0.9 then begin
    WarningSetUp = 0;
    CorrectionSetUp = False;
    Plot2(HighestHigh52*0.9,"Correction",CorrectionColor);
    Value91 = Text_New(D,T,HighestHigh52*0.9,"Correction  ");
    Value92 = Text_SetColor(Value91,CorrectionColor);
    Value93 = Text_SetStyle(Value91,1,2);
End;
If CrashSetUp and L <= HighestHigh52*0.8 then begin
    CrashSetUp = False;
    Plot3(HighestHigh52*0.8,"Crash",CrashColor);
    Value91 = Text_New(D,T,HighestHigh52*0.8,"Crash  ");
    Value92 = Text_SetColor(Value91,CrashColor);
    Value93 = Text_SetStyle(Value91,1,2);
End;

stock-market-crash-indicator-89-92.png


Download
The Stock Market Crash Indicator
 
Last edited:
From the statistics from the link your provided... it appears to be one of those only works if you believe in it indicators (normally geared to lure amateur traders to sell their indicator, however this one appears to be free), however its more based on just grabbing the 52 week high and some other mathematical computation, then predicts a crash/correction happens within up to 18 weeks? 18 weeks is about 1/3 of a year, considering on average there are 2 corrections a year, ide say they are spot on when calculating it at the 52 week high, pretty high odds. Its like saying warning 52 week high atleast one correction will happen within 12 months, the backtesting on that would have a high "TRUE" percentage. Anyhow, to each their own

image.png
 

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

There's a The Stock Market Crash Indicator for TradeStation and I'm wondering if someone in this forum can translate this into ThinkScript? Watch This Video

Code:
Inputs:        WarningColor(White), CorrectionColor(Red), CrashColor(Red);
Variables:    CommLong(0), CommShort(0), TotalOI(0), WarningSetUp(0), CorrectionSetUp(False), CrashSetUp(False), HighestHigh52(C);

CommLong = GetFundData("COTF-12",0);
CommShort = GetFundData("COTF-13",0);
TotalOI = GetFundData("COTF-8",0);

If TotalOI <> 0 then Value1 = (CommLong-CommShort)/TotalOI*100;

If H = Highest(H,52) and Value1 < 0 and WarningSetup = 0 then WarningSetup = 1;
If WarningSetup = 1 and Value1 > 0 then WarningSetup = 2;
If WarningSetup = 2 and Value1 < 0 then begin
    WarningSetUp = 0;
    Plot1(H,"Warning",WarningColor);
    Value91 = Text_New(D,T,H,"Warning  ");
    Value92 = Text_SetColor(Value91,WarningColor);
    Value93 = Text_SetStyle(Value91,1,2);
End;

If H = Highest(H,52) then begin
    CorrectionSetUp = True;
    CrashSetUp = True;
    HighestHigh52 = H;
End;
If CorrectionSetUp and L <= HighestHigh52*0.9 then begin
    WarningSetUp = 0;
    CorrectionSetUp = False;
    Plot2(HighestHigh52*0.9,"Correction",CorrectionColor);
    Value91 = Text_New(D,T,HighestHigh52*0.9,"Correction  ");
    Value92 = Text_SetColor(Value91,CorrectionColor);
    Value93 = Text_SetStyle(Value91,1,2);
End;
If CrashSetUp and L <= HighestHigh52*0.8 then begin
    CrashSetUp = False;
    Plot3(HighestHigh52*0.8,"Crash",CrashColor);
    Value91 = Text_New(D,T,HighestHigh52*0.8,"Crash  ");
    Value92 = Text_SetColor(Value91,CrashColor);
    Value93 = Text_SetStyle(Value91,1,2);
End;

stock-market-crash-indicator-89-92.png


Download
The Stock Market Crash Indicator
Would me nice to have it in ToS!
 
per blog.thetrader.top/thinkorswim-indicator-cot

..."in its pure form, the COT indicator is not present in Thinkorswim"...

The data, simply put, is not available to have this indicator, though you can write it in python (or your choice of languages) using data freely available on the internet. Again, per the cited article:

"The reports present both futures and options. You can go, see and download reports on the official website in the “Market reports” section, then “Commitment of Traders”: https://www.cftc.gov/"

ToS is awesome, and the ability to write custom studies is the thing that keeps me with TD, but with any platform, there will always be things missing if you look hard enough.

-mashume
 
per blog.thetrader.top/thinkorswim-indicator-cot

..."in its pure form, the COT indicator is not present in Thinkorswim"...

The data, simply put, is not available to have this indicator, though you can write it in python (or your choice of languages) using data freely available on the internet. Again, per the cited article:

"The reports present both futures and options. You can go, see and download reports on the official website in the “Market reports” section, then “Commitment of Traders”: https://www.cftc.gov/"

ToS is awesome, and the ability to write custom studies is the thing that keeps me with TD, but with any platform, there will always be things missing if you look hard enough.

-mashume
Yes. I noticed that the Commitment Of Traders data is not available in TOS; however, there must be some other market data in TOS that is available that can come close to what the COT is intended to do. I'm looking for that as a substitute. Other than that, maybe the code can be translated, pending a COT substitute like maybe the Stock Market Days Up vs. Days Down Indicator for ThinkorSwim posted in this forum.
 
All the regulators crank out lots of reports which are somewhat interesting, yet more academic in nature than of practical use. I've never understood the fascination with CoTs personally. But if you're going to study this stuff, CFTC has more interesting reports here - https://www.cftc.gov/MarketReports/ClearedMarginReports/index.htm - it shows how big certain folks are and its easy to see why nobody pays attention to retails' complaints about fills etc.

I know I'm beating a dead horse with this comment, but folks are better off understanding market structure, function and practices to get a glimpse of what goes on. Its boring, its in small letters and its usually not that important - until its the only thing.

I reckon my real point is that true market moving information is so asymmetric in reality , that all these look back reports are historical in nature. Last week's melt-down at Archegos is a great example
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
278 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