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:

XeoNoX

Well-known member
VIP
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
 

Zlotko

Member
VIP
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!
 

mashume

Well-known member
VIP
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
 

Picard

Member
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.
 

codydog

Active member
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

Top