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
Download
The Stock Market Crash Indicator
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;
Download
The Stock Market Crash Indicator
Last edited: