• The price of VIP membership is increasing to $199 beginning June 1. Click here to lock in the current rate of $149.

Previous Day's Percentage Boxes for ThinkorSwim

germanburrito

Active member
Here is the idea behind this indicator, this indicator plots different percentage boxes from the previous days close, if you know that the equity usually moves 1 percent or 2 percent a day, then you may set the parameters to that ticker.

i0FE9KJ.png


Code:
# RH_PreviousDayCloseGapAnalysisSTUDY.ts
#German_Burrito


declare upper;
input percentage = .5;
input percentage_2 = .75;
input percentage_3 = 1.0;

def lastDayToday    = if GetLastDay() == GetDay() and GetLastYear() == GetYear() then yes else no;
plot PrevDayClose   = HighestAll( if lastDayToday then close( period = "DAY" )[1] else Double.NaN );

plot limit = prevDayClose * (1 + (percentage*.01));
plot limit2 = prevDayClose * (1 - (percentage*.01));
plot limit3 = prevDayClose * (1 + (percentage_2 *.01));
plot limit4 = prevDayClose * (1 - (percentage_2 *.01));
plot limit5 = prevDayClose * (1 + (percentage_3 *.01));
plot limit6 = prevDayClose * (1 - (percentage_3 *.01));


AddCloud( limit, prevDayClose, Color.yellow );
AddCloud( prevDayClose, limit2, Color.yellow );
AddCloud( limit3, limit, Color.light_orange );
AddCloud( limit2, limit4, Color.light_orange );
AddCloud( limit4, limit6, Color.light_green );
AddCloud( limit3, limit5, Color.light_red );


prevDayClose.SetDefaultColor(Color.WHITE);
limit.SetDefaultColor(Color.LIGHT_RED);
limit2.SetDefaultColor(Color.LIGHT_GREEN);
limit3.SetDefaultColor(Color.LIGHT_RED);
limit4.SetDefaultColor(Color.LIGHT_GREEN);
limit5.SetDefaultColor(Color.LIGHT_RED);
limit6.SetDefaultColor(Color.LIGHT_GREEN);
[code/]
 
Last edited by a moderator:

Similar threads

Top