Auto Significant Price Levels for ThinkorSwim

@rlohmeyer: Thank you for sharing the level indicator. I have been looking for something like this for a long time. I have couple of questions:
1. What is the significance of yellow line?
2. What is the recommended setting for "Increment" and "Major"
3. What does PD, PU and SMU mean?
 
Last edited by a moderator:
@rlohmeyer: Thank you for sharing the level indicator. I have been looking for something like this for a long time. I have couple of questions:
1. What is the significance of yellow line?
2. What is the recommended setting for "Increment" and "Major"
3. What does PD, PU and SMU mean?
@Kislayakanan

Sorry for the delay. Below is the code for for the Price Time Grid indicator. The picture below that shows this indicator on a 1 minute chart of QQQ.,which is at this point the only instrument I day trade.

bOyGoP0.jpg




Code:
#PriceTimeGrid
#@rlohmeyer shared on UseThinkscript
#Thanks to @OBW, @SleepyZ, and @Generic when I got stuck with code
# 3/11/2021
input plotgrid = yes;
input increment = 1.00;
input ShowMidpoint = yes;
def Mid = if plotgrid then increment/2 else double.NaN;
def na = double.NaN;
input major = 5.00;
def c = close;
def o = open;

#Plot Icrements
def start = if plotgrid then Round(open / major, 0) * major else double.NaN;
def str = if !IsNaN(c) and IsNaN(c[-1]) then start else str[1];
plot ST = if IsNaN(c[-780]) then str[-780] else Double.NaN;
ST.SetDefaultColor(CreateColor(255, 4, 204));
ST.HideTitle();
ST.SetPaintingStrategy(PaintingStrategy.horizontal);
ST.SetLineWeight(1);

#Plot Up Lines
plot MU = (if ShowMidpoint == 1 then ST + Mid else na);
MU.AssignValueColor(Color.light_gray);
MU.HideTitle();
MU.SetPaintingStrategy(PaintingStrategy.dashes);
MU.SetLineWeight(1);
MU.Hidebubble();
plot PU1 = ST + INCREMENT;
PU1.AssignValueColor(if (PU1/major)/Round((PU1/major),0) == 1 then (CreateColor(255, 4, 204)) else Color.white);
PU1.HideTitle();
PU1.SetPaintingStrategy(PaintingStrategy.horizontal);
PU1.SetLineWeight(1);
plot MU1 = (if ShowMidpoint == 1 then PU1 + Mid else na);
MU1.AssignValueColor(Color.light_gray);
MU1.HideTitle();
MU1.SetPaintingStrategy(PaintingStrategy.dashes);
MU1.SetLineWeight(1);
MU1.Hidebubble();
plot PU2 = ST + (2 * INCREMENT);
PU2.AssignValueColor(if (PU2/major)/Round((PU2/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU2.HideTitle();
PU2.SetPaintingStrategy(PaintingStrategy.horizontal);
PU2.SetLineWeight(1);
plot MU2 = (if ShowMidpoint == 1 then PU2 + Mid else na);
MU2.AssignValueColor(Color.light_gray);
MU2.HideTitle();
MU2.SetPaintingStrategy(PaintingStrategy.dashes);
MU2.SetLineWeight(1);
MU2.Hidebubble();
plot PU3 = ST + (3 * INCREMENT);
PU3.AssignValueColor(if (PU3/major)/Round((PU3/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU3.HideTitle();
PU3.SetPaintingStrategy(PaintingStrategy.horizontal);
PU3.SetLineWeight(1);
plot MU3 = (if ShowMidpoint == 1 then PU3 + Mid else na);
MU3.AssignValueColor(Color.light_gray);
MU3.HideTitle();
MU3.SetPaintingStrategy(PaintingStrategy.dashes);
MU3.SetLineWeight(1);
MU3.Hidebubble();
plot PU4 = ST + (4 * INCREMENT);
PU4.AssignValueColor(if (PU4/major)/Round((PU4/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU4.HideTitle();
PU4.SetPaintingStrategy(PaintingStrategy.horizontal);
PU4.SetLineWeight(1);
plot MU4 = (if ShowMidpoint == 1 then PU4 + Mid else na);
MU4.AssignValueColor(Color.light_gray);
MU4.HideTitle();
MU4.SetPaintingStrategy(PaintingStrategy.dashes);
MU4.SetLineWeight(1);
MU4.Hidebubble();
plot PU5 =  ST + (5 * INCREMENT);
PU5.AssignValueColor(if (PU5/major)/Round((PU5/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU5.HideTitle();
PU5.SetPaintingStrategy(PaintingStrategy.horizontal);
PU5.SetLineWeight(1);
plot MU5 = (if ShowMidpoint == 1 then PU5 + Mid else na);
MU5.AssignValueColor(Color.light_gray);
MU5.HideTitle();
MU5.SetPaintingStrategy(PaintingStrategy.dashes);
MU5.SetLineWeight(1);
MU5.Hidebubble();
plot PU6 =  ST + (6 * INCREMENT);
PU6.AssignValueColor(if (PU6/major)/Round((PU6/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU6.HideTitle();
PU6.SetPaintingStrategy(PaintingStrategy.horizontal);
PU6.SetLineWeight(1);
plot MU6 = (if ShowMidpoint == 1 then PU6 + Mid else na);
MU6.AssignValueColor(Color.light_gray);
MU6.HideTitle();
MU6.SetPaintingStrategy(PaintingStrategy.dashes);
MU6.SetLineWeight(1);
MU6.Hidebubble();
plot PU7 =  ST + (7 * INCREMENT);
PU7.AssignValueColor(if (PU7/major)/Round((PU7/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU7.HideTitle();
PU7.SetPaintingStrategy(PaintingStrategy.horizontal);
PU7.SetLineWeight(1);
plot MU7 = (if ShowMidpoint == 1 then PU7 + Mid else na);
MU7.AssignValueColor(Color.light_gray);
MU7.HideTitle();
MU7.SetPaintingStrategy(PaintingStrategy.dashes);
MU7.SetLineWeight(1);
MU7.Hidebubble();
plot PU8 =  ST + (8 * INCREMENT);
PU8.AssignValueColor(if (PU8/major)/Round((PU8/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU8.HideTitle();
PU8.SetPaintingStrategy(PaintingStrategy.horizontal);
PU8.SetLineWeight(1);
plot MU8 = (if ShowMidpoint == 1 then PU8 + Mid else na);
MU8.AssignValueColor(Color.light_gray);
MU8.HideTitle();
MU8.SetPaintingStrategy(PaintingStrategy.dashes);
MU8.SetLineWeight(1);
MU8.Hidebubble();
plot PU9 =  ST + (9 * INCREMENT);
PU9.AssignValueColor(if (PU9/major)/Round((PU9/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU9.HideTitle();
PU9.SetPaintingStrategy(PaintingStrategy.horizontal);
PU9.SetLineWeight(1);
plot MU9 = (if ShowMidpoint == 1 then PU9 + Mid else na);
MU9.AssignValueColor(Color.light_gray);
MU9.HideTitle();
MU9.SetPaintingStrategy(PaintingStrategy.dashes);
MU9.SetLineWeight(1);
MU9.Hidebubble();
plot PU10 =  ST + (10 * INCREMENT);
PU10.AssignValueColor(if (PU10/major)/Round((PU10/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU10.HideTitle();
PU10.SetPaintingStrategy(PaintingStrategy.horizontal);
PU10.SetLineWeight(1);
plot MU10 = (if ShowMidpoint == 1 then PU10 + Mid else na);
MU10.AssignValueColor(Color.light_gray);
MU10.HideTitle();
MU10.SetPaintingStrategy(PaintingStrategy.dashes);
MU10.SetLineWeight(1);
MU10.Hidebubble();
plot PU11 =  ST + (11 * INCREMENT);
PU11.AssignValueColor(if (PU11/major)/Round((PU11/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU11.HideTitle();
PU11.SetPaintingStrategy(PaintingStrategy.horizontal);
PU11.SetLineWeight(1);
plot MU11 = (if ShowMidpoint == 1 then PU11 + Mid else na);
MU11.AssignValueColor(Color.light_gray);
MU11.HideTitle();
MU11.SetPaintingStrategy(PaintingStrategy.dashes);
MU11.SetLineWeight(1);
MU11.Hidebubble();
plot PU12 =  ST + (12 * INCREMENT);
PU12.AssignValueColor(if (PU12/major)/Round((PU12/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU12.HideTitle();
PU12.SetPaintingStrategy(PaintingStrategy.horizontal);
PU12.SetLineWeight(1);
plot MU12 = (if ShowMidpoint == 1 then PU12 + Mid else na);
MU12.AssignValueColor(Color.light_gray);
MU12.HideTitle();
MU12.SetPaintingStrategy(PaintingStrategy.dashes);
MU12.SetLineWeight(1);
MU12.Hidebubble();
plot PU13 =  ST + (13 * INCREMENT);
PU13.AssignValueColor(if (PU13/major)/Round((PU13/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU13.HideTitle();
PU13.SetPaintingStrategy(PaintingStrategy.horizontal);
PU13.SetLineWeight(1);
plot MU13 = (if ShowMidpoint == 1 then PU13 + Mid else na);
MU13.AssignValueColor(Color.light_gray);
MU13.HideTitle();
MU13.SetPaintingStrategy(PaintingStrategy.dashes);
MU13.SetLineWeight(1);
MU13.Hidebubble();
plot PU14 =  ST + (14 * INCREMENT);
PU14.AssignValueColor(if (PU14/major)/Round((PU14/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU14.HideTitle();
PU14.SetPaintingStrategy(PaintingStrategy.horizontal);
PU14.SetLineWeight(1);
plot MU14 = (if ShowMidpoint == 1 then PU14 + Mid else na);
MU14.AssignValueColor(Color.light_gray);
MU14.HideTitle();
MU14.SetPaintingStrategy(PaintingStrategy.dashes);
MU14.SetLineWeight(1);
MU14.Hidebubble();
plot PU15 =  ST + (15 * INCREMENT);
PU15.AssignValueColor(if (PU15/major)/Round((PU15/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU15.HideTitle();
PU15.SetPaintingStrategy(PaintingStrategy.horizontal);
PU15.SetLineWeight(1);
plot MU15 = (if ShowMidpoint == 1 then PU15 + Mid else na);
MU15.AssignValueColor(Color.light_gray);
MU15.HideTitle();
MU15.SetPaintingStrategy(PaintingStrategy.dashes);
MU15.SetLineWeight(1);
MU15.Hidebubble();
plot PU16 =  ST + (16 * INCREMENT);
PU16.AssignValueColor(if (PU16/major)/Round((PU16/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU16.HideTitle();
PU16.SetPaintingStrategy(PaintingStrategy.horizontal);
PU16.SetLineWeight(1);
plot MU16 = (if ShowMidpoint == 1 then PU16 + Mid else na);
MU16.AssignValueColor(Color.light_gray);
MU16.HideTitle();
MU16.SetPaintingStrategy(PaintingStrategy.dashes);
MU16.SetLineWeight(1);
MU16.Hidebubble();
plot PU17 =  ST + (17 * INCREMENT);
PU17.AssignValueColor(if (PU17/major)/Round((PU17/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU17.HideTitle();
PU17.SetPaintingStrategy(PaintingStrategy.horizontal);
PU17.SetLineWeight(1);
plot MU17 = (if ShowMidpoint == 1 then PU17 + Mid else na);
MU17.AssignValueColor(Color.light_gray);
MU17.HideTitle();
MU17.SetPaintingStrategy(PaintingStrategy.dashes);
MU17.SetLineWeight(1);
MU17.Hidebubble();
plot PU18 =  ST + (18 * INCREMENT);
PU18.AssignValueColor(if (PU18/major)/Round((PU18/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU18.HideTitle();
PU18.SetPaintingStrategy(PaintingStrategy.horizontal);
PU18.SetLineWeight(1);
plot MU18 = (if ShowMidpoint == 1 then PU18 + Mid else na);
MU18.AssignValueColor(Color.light_gray);
MU18.HideTitle();
MU18.SetPaintingStrategy(PaintingStrategy.dashes);
MU18.SetLineWeight(1);
MU18.Hidebubble();
plot PU19 =  ST + (19 * INCREMENT);
PU19.AssignValueColor(if (PU19/major)/Round((PU19/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU19.HideTitle();
PU19.SetPaintingStrategy(PaintingStrategy.horizontal);
PU19.SetLineWeight(1);
plot MU19 = (if ShowMidpoint == 1 then PU19 + Mid else na);
MU19.AssignValueColor(Color.light_gray);
MU19.HideTitle();
MU19.SetPaintingStrategy(PaintingStrategy.dashes);
MU19.SetLineWeight(1);
MU19.Hidebubble();
plot PU20 =  ST + (20 * INCREMENT);
PU20.AssignValueColor(if (PU20/major)/Round((PU20/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PU20.HideTitle();
PU20.SetPaintingStrategy(PaintingStrategy.horizontal);
PU20.SetLineWeight(1);

#Plot Down Lines
plot MD = (if ShowMidpoint == 1 then ST - Mid else na);
MD.AssignValueColor(Color.light_gray);
MD.HideTitle();
MD.SetPaintingStrategy(PaintingStrategy.dashes);
MD.SetLineWeight(1);
MD.Hidebubble();
plot PD1 =  ST - INCREMENT ;
PD1.AssignValueColor(if (PD1/major)/Round((PD1/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD1.HideTitle();
PD1.SetPaintingStrategy(PaintingStrategy.horizontal);
PD1.SetLineWeight(1);
plot MD1 = (if ShowMidpoint == 1 then PD1 - Mid else na);
MD1.AssignValueColor(Color.light_gray);
MD1.HideTitle();
MD1.SetPaintingStrategy(PaintingStrategy.dashes);
MD1.SetLineWeight(1);
MD1.Hidebubble();
plot PD2 =  ST - (2 * INCREMENT) ;
PD2.AssignValueColor(if (PD2/major)/Round((PD2/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD2.HideTitle();
PD2.SetPaintingStrategy(PaintingStrategy.horizontal);
PD2.SetLineWeight(1);
plot MD2 = (if ShowMidpoint == 1 then PD2 - Mid else na);
MD2.AssignValueColor(Color.light_gray);
MD2.HideTitle();
MD2.SetPaintingStrategy(PaintingStrategy.dashes);
MD2.SetLineWeight(1);
MD2.Hidebubble();
plot PD3 =  ST - (3 * INCREMENT);
PD3.AssignValueColor(if (PD3/major)/Round((PD3/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD3.HideTitle();
PD3.SetPaintingStrategy(PaintingStrategy.horizontal);
PD3.SetLineWeight(1);
plot MD3 = (if ShowMidpoint == 1 then PD3 - Mid else na);
MD3.AssignValueColor(Color.light_gray);
MD3.HideTitle();
MD3.SetPaintingStrategy(PaintingStrategy.dashes);
MD3.SetLineWeight(1);
MD3.Hidebubble();
plot PD4 =  ST - (4 * INCREMENT);
PD4.AssignValueColor(if (PD4/major)/Round((PD4/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD4.HideTitle();
PD4.SetPaintingStrategy(PaintingStrategy.horizontal);
PD4.SetLineWeight(1);
plot MD4 = (if ShowMidpoint == 1 then PD4 - Mid else na);
MD4.AssignValueColor(Color.light_gray);
MD4.HideTitle();
MD4.SetPaintingStrategy(PaintingStrategy.dashes);
MD4.SetLineWeight(1);
MD4.Hidebubble();
plot PD5 =  ST - (5 * INCREMENT);
PD5.AssignValueColor(if (PD5/major)/Round((PD5/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD5.HideTitle();
PD5.SetPaintingStrategy(PaintingStrategy.horizontal);
PD5.SetLineWeight(1);
plot MD5 = (if ShowMidpoint == 1 then PD5 - Mid else na);
MD5.AssignValueColor(Color.light_gray);
MD5.HideTitle();
MD5.SetPaintingStrategy(PaintingStrategy.dashes);
MD5.SetLineWeight(1);
MD5.Hidebubble();
plot PD6 =  ST - (6 * INCREMENT);
PD6.AssignValueColor(if (PD6/major)/Round((PD6/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD6.HideTitle();
PD6.SetPaintingStrategy(PaintingStrategy.horizontal);
PD6.SetLineWeight(1);
plot MD6 = (if ShowMidpoint == 1 then PD6 - Mid else na);
MD6.AssignValueColor(Color.light_gray);
MD6.HideTitle();
MD6.SetPaintingStrategy(PaintingStrategy.dashes);
MD6.SetLineWeight(1);
MD6.Hidebubble();
plot PD7 =  ST - (7 * INCREMENT);
PD7.AssignValueColor(if (PD7/major)/Round((PD7/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD7.HideTitle();
PD7.SetPaintingStrategy(PaintingStrategy.horizontal);
PD7.SetLineWeight(1);
plot MD7 = (if ShowMidpoint == 1 then PD7 - Mid else na);
MD7.AssignValueColor(Color.light_gray);
MD7.HideTitle();
MD7.SetPaintingStrategy(PaintingStrategy.dashes);
MD7.SetLineWeight(1);
MD7.Hidebubble();
plot PD8 =  ST - (8 * INCREMENT);
PD8.AssignValueColor(if (PD8/major)/Round((PD8/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD8.HideTitle();
PD8.SetPaintingStrategy(PaintingStrategy.horizontal);
PD8.SetLineWeight(1);
plot MD8 = (if ShowMidpoint == 1 then PD8 - Mid else na);
MD8.AssignValueColor(Color.light_gray);
MD8.HideTitle();
MD8.SetPaintingStrategy(PaintingStrategy.dashes);
MD8.SetLineWeight(1);
MD8.Hidebubble();
plot PD9 =  ST - (9 * INCREMENT);
PD9.AssignValueColor(if (PD9/major)/Round((PD9/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD9.HideTitle();
PD9.SetPaintingStrategy(PaintingStrategy.horizontal);
PD9.SetLineWeight(1);
plot MD9 = (if ShowMidpoint == 1 then PD9 - Mid else na);
MD9.AssignValueColor(Color.light_gray);
MD9.HideTitle();
MD9.SetPaintingStrategy(PaintingStrategy.dashes);
MD9.SetLineWeight(1);
MD9.Hidebubble();
plot PD10 =  ST - (10 * INCREMENT);
PD10.AssignValueColor(if (PD10/major)/Round((PD10/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD10.HideTitle();
PD10.SetPaintingStrategy(PaintingStrategy.horizontal);
PD10.SetLineWeight(1);
plot MD10 = (if ShowMidpoint == 1 then PD10 - Mid else na);
MD10.AssignValueColor(Color.light_gray);
MD10.HideTitle();
MD10.SetPaintingStrategy(PaintingStrategy.dashes);
MD10.SetLineWeight(1);
MD10.Hidebubble();
plot PD11 =  ST - (11 * INCREMENT);
PD11.AssignValueColor(if (PD11/major)/Round((PD11/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD11.HideTitle();
PD11.SetPaintingStrategy(PaintingStrategy.horizontal);
PD11.SetLineWeight(1);
plot MD11 = (if ShowMidpoint == 1 then PD11 - Mid else na);
MD11.AssignValueColor(Color.light_gray);
MD11.HideTitle();
MD11.SetPaintingStrategy(PaintingStrategy.dashes);
MD11.SetLineWeight(1);
MD11.Hidebubble();
plot PD12 =  ST - (12 * INCREMENT);
PD12.AssignValueColor(if (PD12/major)/Round((PD12/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD12.HideTitle();
PD12.SetPaintingStrategy(PaintingStrategy.horizontal);
PD12.SetLineWeight(1);
plot MD12 = (if ShowMidpoint == 1 then PD12 - Mid else na);
MD12.AssignValueColor(Color.light_gray);
MD12.HideTitle();
MD12.SetPaintingStrategy(PaintingStrategy.dashes);
MD12.SetLineWeight(1);
MD12.Hidebubble();
plot PD13 =  ST - (13 * INCREMENT);
PD13.AssignValueColor(if (PD13/major)/Round((PD13/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD13.HideTitle();
PD13.SetPaintingStrategy(PaintingStrategy.horizontal);
PD13.SetLineWeight(1);
plot MD13 = (if ShowMidpoint == 1 then PD13 - Mid else na);
MD13.AssignValueColor(Color.light_gray);
MD13.HideTitle();
MD13.SetPaintingStrategy(PaintingStrategy.dashes);
MD13.SetLineWeight(1);
MD13.Hidebubble();
plot PD14 =  ST - (14 * INCREMENT);
PD14.AssignValueColor(if (PD14/major)/Round((PD14/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD14.HideTitle();
PD14.SetPaintingStrategy(PaintingStrategy.horizontal);
PD14.SetLineWeight(1);
plot MD14 = (if ShowMidpoint == 1 then PD14 - Mid else na);
MD14.AssignValueColor(Color.light_gray);
MD14.HideTitle();
MD14.SetPaintingStrategy(PaintingStrategy.dashes);
MD14.SetLineWeight(1);
MD14.Hidebubble();
plot PD15 =  ST - (15 * INCREMENT);
PD15.AssignValueColor(if (PD15/major)/Round((PD15/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD15.HideTitle();
PD15.SetPaintingStrategy(PaintingStrategy.horizontal);
PD15.SetLineWeight(1);
plot MD15 = (if ShowMidpoint == 1 then PD15 - Mid else na);
MD15.AssignValueColor(Color.light_gray);
MD15.HideTitle();
MD15.SetPaintingStrategy(PaintingStrategy.dashes);
MD15.SetLineWeight(1);
MD15.Hidebubble();
plot PD16 =  ST - (16 * INCREMENT);
PD16.AssignValueColor(if (PD16/major)/Round((PD16/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD16.HideTitle();
PD16.SetPaintingStrategy(PaintingStrategy.horizontal);
PD16.SetLineWeight(1);
plot MD16 = (if ShowMidpoint == 1 then PD16 - Mid else na);
MD16.AssignValueColor(Color.light_gray);
MD16.HideTitle();
MD16.SetPaintingStrategy(PaintingStrategy.dashes);
MD16.SetLineWeight(1);
MD16.Hidebubble();
plot PD17 =  ST - (17 * INCREMENT);
PD17.AssignValueColor(if (PD17/major)/Round((PD17/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD17.HideTitle();
PD17.SetPaintingStrategy(PaintingStrategy.horizontal);
PD17.SetLineWeight(1);
plot MD17 = (if ShowMidpoint == 1 then PD17 - Mid else na);
MD17.AssignValueColor(Color.light_gray);
MD17.HideTitle();
MD17.SetPaintingStrategy(PaintingStrategy.dashes);
MD17.SetLineWeight(1);
MD17.Hidebubble();
plot PD18 =  ST - (18 * INCREMENT);
PD18.AssignValueColor(if (PD18/major)/Round((PD18/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD18.HideTitle();
PD18.SetPaintingStrategy(PaintingStrategy.horizontal);
PD18.SetLineWeight(1);
plot MD18 = (if ShowMidpoint == 1 then PD18 - Mid else na);
MD18.AssignValueColor(Color.light_gray);
MD18.HideTitle();
MD18.SetPaintingStrategy(PaintingStrategy.dashes);
MD18.SetLineWeight(1);
MD18.Hidebubble();
plot PD19 =  ST - (19 * INCREMENT);
PD19.AssignValueColor(if (PD19/major)/Round((PD19/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD19.HideTitle();
PD19.SetPaintingStrategy(PaintingStrategy.horizontal);
PD19.SetLineWeight(1);
plot MD19 = (if ShowMidpoint == 1 then PD19 - Mid else na);
MD19.AssignValueColor(Color.light_gray);
MD19.HideTitle();
MD19.SetPaintingStrategy(PaintingStrategy.dashes);
MD19.SetLineWeight(1);
MD19.Hidebubble();
plot PD20 =  ST - (20 * INCREMENT);
PD20.AssignValueColor(if (PD20/major)/Round((PD20/major),0)== 1 then (CreateColor(255, 4, 204)) else Color.white);
PD20.HideTitle();
PD20.SetPaintingStrategy(PaintingStrategy.horizontal);
PD20.SetLineWeight(1);


#Vertical Line at minutes interval
#Sleepyz
input verticle_minutes1 = 5;
input verticle_minutes2 = 15;
input verticle_minutes3 = 30;
def NYbegin   = 0930;
def NYend     = 1600;

def bar       = if SecondsTillTime(NYbegin) == 0 and
                   SecondsFromTime(NYbegin) == 0
                then 0
                else bar[1] + 1;

input show_vertical_lines= yes;
AddVerticalLine(if plotgrid and show_vertical_lines  and SecondsFromTime(NYbegin) >= 0 and secondsfromTime(NYend)<=0
                then bar % (ceil(verticle_minutes1) / (GetAggregationPeriod() / 60000)) == 0
                else Double.NaN,
                color = Color.light_gray, stroke = Curve.short_dash);
AddVerticalLine(if plotgrid and show_vertical_lines  and SecondsFromTime(NYbegin) >= 0 and secondsfromTime(NYend)<=0
                then bar % (ceil(verticle_minutes2) / (GetAggregationPeriod() / 60000)) == 0
                else Double.NaN,
                color = Color.light_gray, stroke = Curve.medium_dash);
AddVerticalLine(if plotgrid and show_vertical_lines  and SecondsFromTime(NYbegin) >= 0 and secondsfromTime(NYend)<=0
                then bar % (ceil(verticle_minutes3) / (GetAggregationPeriod() / 60000)) == 0
                else Double.NaN,
                color = Color.light_gray, stroke = Curve.long_dash);
 
I am sharing another S/R Indicator I use on my charts. .....

PS; In any of you wizard coders can simplify my coding, please feel free. I would like to be able to specifically choose how many bars back to draw high and low lines.

hello, just came across this post again. i know it was from awhile ago.
not sure if this was answered, so here is a test code to experiment with.

the user picks a bar quantity and,
. it plots a vertical line x bars back from the last bar
. it draws a horizontal line , from x bars back to the last bar. this is variable v. i think this could be used an enable in a formula, to do what you want.

Ruby:
# barsback_series_0

# pick a bar , x bars back from the last bar
input barsback = 50;
def x = ( !isnan(close[-barsback]) and isnan(close[-(barsback+1)] ));
addverticalline(x, barsback + " bars ago", color.yellow);

# -------------------------------

# enable a series of bars, before the last bar
def bn = barnumber();
def na = double.nan;
#input barsback = 50;
def v = ( !isnan(close[0]) and isnan(close[-(barsback+1)] ));
# get a $ level from 1st bar in series
def start = if bn == 1 then na else if (v and !v[1]) then close else start[1];
plot z = if v then start else na;
z.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
z.SetDefaultColor(Color.cyan);
z.SetLineWeight(1);
z.hidebubble();
#
 
@halcyonguy

Thank you. I cannot remember what my issue was at the time, but this is a very nice code sample I plan to save...there are a number of scenarios I can envision using it.

Regards,
Bob
 
@rlohmeyer I'm absolutely in love with this code! it been a a huge help in identifying significant levels quickly. My question is I trade premarket sometimes and I can't seem to get the code to display those lines during those hours (7-9:28 a.m ET). Any pointers on how to fix this would be greatly appreciated.

Thank you,
Kev
 
@kckilla

Hi,

I assume you are talking about the code for the PriceTimeGrid...if so I will look at this and see what I can do. I can spend some time with it this weekend.

Take Care,
Bob
 
@rlohmeyer Hi Bob, thanks for the reply. I'm actually been using the Auto Price Levels with the 2/18/21 Revision. It is my favorite indicator right now and I can't go back to regular TOS grid. I been manually drawing those levels premarket since I can't get it to work lol

Have A Great Weekend!
Kev
 
@rlohmeyer
Hello I have been reading all the posts above, their is a lot of codes and scripts how to determine which one the updated version for Auto Price Level and volume code , would be very appreciated .
 
@kckilla

I have looked at the premarket for the PriceTimeGrid and the Price Lines display premarket. Are you talking about the Vertical Time Lines specifically?

Bob
 
@kckilla

I have looked at the premarket for the PriceTimeGrid and the Price Lines display premarket. Are you talking about the Vertical Time Lines specifically?

Bob
Hello
Thanks for answering quickly , yes please was taking about Premarket for PriceTimeGrid. I can't wait to try it Monday morning.
 
Hi and thanks for putting these indicators together. Went through all 5 pages and used the formulation in post 82. Still a bit confused on all the settings/parameters and other posts with their respective scripts. Ultimately looking to try this with ES. From reading the last 2 pages, it looks like you're using this setup on the Q's. Would it be possible to share your setup so I can see how it should look on the charts? Trying to get a feel of how the chart is setup. I would change to ES and make necessary adjustments on my end. Much appreciated and thank you again for all your help to the community!
 
@kckilla

As I said, the Horizontal Price Lines show on the premarket time frames without you having to change anything. The NYBegin time input will need to be changed in the code so that you can display premarket Vertical Time Lines. Look at the image below. Open the code for the indicator and go to line 474, then change the 930 to 700 in order to show vertical time lines starting at 7AM New York Time. That would be all you would need to do.
DEqJ1xH.jpg


@rfb
Below is an image of the options for the PriceTimeGrid....and here are what they do:
1. plotgrid--allow you to turn the grid on and off (say if you wanted to view your chart without it to see other indicators more clearly but you did not want to remove the indicator from your chart.
2. increment-- is the main price level that you feel has significance for the instrument you trade, for me trading the QQQ it is $1--this shows on the chart as Solid While Line with bubble
3.show midpoints--will show the midpoints between the increments..so on the Q it is showing $.50--show as broken light gray line
4. major--this is the higher level price increment that you consider important--on the Q I use $5--shows on the chart as bright Magenta with a bubble so that it is highly visible
5. vertical minutes 1 2 and 3--- (I noticed I misspelled vertical, sorry about that)---these give you 3 options to show vertical time lines--if I decide to trade a 1 minute chart of the Q I would set this up for 5,15,and 30 minute lines--each time line is different so it is noticeable. These can mark transition points in the trading, especially the 30 minute time line from the start of the NY Session, for Q's
6. show vertical lines--mean what it says, on or off switch to show on the chart or not
98a8xEz.jpg


Here is an image of my chart setup for Friday with 2 minute bars
Vfo2TzX.jpg
 
Last edited:
@rlohmeyer those vertical lines are time based. Is there any way you can make them Horizontal for like 10 and 240 minutes. They act as a good support and resistance levels on 1 or 2 minute chart..
 
Hi and thanks for putting these indicators together. Went through all 5 pages and used the formulation in post 82. Still a bit confused on all the settings/parameters and other posts with their respective scripts. Ultimately looking to try this with ES. From reading the last 2 pages, it looks like you're using this setup on the Q's. Would it be possible to share your setup so I can see how it should look on the charts? Trying to get a feel of how the chart is setup. I would change to ES and make necessary adjustments on my end. Much appreciated and thank you again for all your help to the community!
Try 10 point or more for es on 1 or 2 minute chart
 
  • Like
Reactions: rfb
@Grroov Don't understand what you are asking for. The vertical lines are used in this indicator for identifying specific time periods. In the chart it is the 30 minute period. The horizontal lines are price based. Please clarify.
 
@Grroov Don't understand what you are asking for. The vertical lines are used in this indicator for identifying specific time periods. In the chart it is the 30 minute period. The horizontal lines are price based. Please clarify.
Yes instead of price based Horizontal lines, can you make time based Horizontal lines..
 
@kckilla

As I said, the Horizontal Price Lines show on the premarket time frames without you having to change anything. The NYBegin time input will need to be changed in the code so that you can display premarket Vertical Time Lines. Look at the image below. Open the code for the indicator and go to line 474, then change the 930 to 700 in order to show vertical time lines starting at 7AM New York Time. That would be all you would need to do.
DEqJ1xH.jpg


@rfb
Below is an image of the options for the PriceTimeGrid....and here are what they do:
1. plotgrid--allow you to turn the grid on and off (say if you wanted to view your chart without it to see other indicators more clearly but you did not want to remove the indicator from your chart.
2. increment-- is the main price level that you feel has significance for the instrument you trade, for me trading the QQQ it is $1--this shows on the chart as Solid While Line with bubble
3.show midpoints--will show the midpoints between the increments..so on the Q it is showing $.50--show as broken light gray line
4. major--this is the higher level price increment that you consider important--on the Q I use $5--shows on the chart as bright Magenta with a bubble so that it is highly visible
5. vertical minutes 1 2 and 3--- (I noticed I misspelled vertical, sorry about that)---these give you 3 options to show vertical time lines--if I decide to trade a 1 minute chart of the Q I would set this up for 5,15,and 30 minute lines--each time line is different so it is noticeable. These can mark transition points in the trading, especially the 30 minute time line from the start of the NY Session, for Q's
6. show vertical lines--mean what it says, on or off switch to show on the chart or not
98a8xEz.jpg


Here is an image of my chart setup for Friday with 2 minute bars
Vfo2TzX.jpg
Thanks for the quick reply and tips. I'll take a look at the settings a bit more.
 
@kckilla

As I said, the Horizontal Price Lines show on the premarket time frames without you having to change anything. The NYBegin time input will need to be changed in the code so that you can display premarket Vertical Time Lines. Look at the image below. Open the code for the indicator and go to line 474, then change the 930 to 700 in order to show vertical time lines starting at 7AM New York Time. That would be all you would need to do.
DEqJ1xH.jpg


@rfb
Below is an image of the options for the PriceTimeGrid....and here are what they do:
1. plotgrid--allow you to turn the grid on and off (say if you wanted to view your chart without it to see other indicators more clearly but you did not want to remove the indicator from your chart.
2. increment-- is the main price level that you feel has significance for the instrument you trade, for me trading the QQQ it is $1--this shows on the chart as Solid While Line with bubble
3.show midpoints--will show the midpoints between the increments..so on the Q it is showing $.50--show as broken light gray line
4. major--this is the higher level price increment that you consider important--on the Q I use $5--shows on the chart as bright Magenta with a bubble so that it is highly visible
5. vertical minutes 1 2 and 3--- (I noticed I misspelled vertical, sorry about that)---these give you 3 options to show vertical time lines--if I decide to trade a 1 minute chart of the Q I would set this up for 5,15,and 30 minute lines--each time line is different so it is noticeable. These can mark transition points in the trading, especially the 30 minute time line from the start of the NY Session, for Q's
6. show vertical lines--mean what it says, on or off switch to show on the chart or not
98a8xEz.jpg


Here is an image of my chart setup for Friday with 2 minute bars
Vfo2TzX.jpg
Looking closer at this chart setup, you have additional studies added. Just wondering for ease and continuity of studying this type of chart, would you be able to share the same setup link? If not, no worries and thanks again for your info.
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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