Weekly and Monthly Pivots Indicator for ThinkorSwim

Hi all,
I am a newbie here on the forum. I am new to scripting, but I would love to learn it. I have a question. First how can I post a picture that has not any http address?
Secondly, I like to know, how can I add/make pivots the same as TC-2000 in Thinkorswim and Tradingview. Can someone help me?

Thanks a lot!
 
@stt31 https://usethinkscript.com/threads/how-to-insert-image-in-a-post-thread.277/

To find "pivot studies"
  1. Click on the magnifying search button in the upper-right hand corner of your screen
  2. Type pivot in the search box
  3. Click on Search Titles Only
Plug and play the Pivot Indicators and see which provides you with what you are looking for. If you can not find one that does exactly what you want. Come back and explain in detail why you think yours is superior to the existing indicators on this forum and illustrate with screenshots: the comparisons, and differences between them so we can understand what modifications you are looking for.
 
Thanks for the update to daily. You said, "I've enhanced the Pivot Point Indicator by adding Daily Pivot Points, so now you can put Daily Pivots on a Hourly chart :) I would suggest a longer time period than 1 day...perhaps 10 or 20 days... " How do you enter multiple days in the code?
thank you all, would it be it possible for you to add labels on the left for example daily R1 vs Weekly R1, also is it possible to condense it all into one study that shows daily, weekly and monthly levels all at once, I love trading with pivot levels, it would be great if they were all automatically set instead of having to calculate them all, thank you in advance. Also for the daily pivot could you include mid points between those levels
 
Last edited:
@BenTen I decided to help contribute, I added mid levels for the daily , all I need now are the labels. please check if i missed any errors, this was my first time modifying a script

Ruby:
input timeFrame = {DAY, default WEEK, MONTH};
input showOnlyToday = no;

def H = high(period = timeFrame)[1];
def L = low(period = timeFrame)[1];
def C = close(period = timeFrame)[1];

def calc_PP = (H + L + C) / 3;
def calc_R1 = (2 * calc_PP) - L;
def calc_RMid = (calc_PP + calc_R1) / 2;
def calc_R2 = calc_PP + H - L;
def calc_R1Mid = (calc_R1 + calc_R2) / 2;
def calc_R3 = H + 2 * (calc_PP - L);
def calc_R2Mid = (calc_R2 + calc_R3) / 2;

def calc_S1 = (2 * calc_PP) - H;
def calc_SMid = (calc_PP + calc_S1) / 2;
def calc_S2 = calc_PP - H + L;
def calc_S1Mid = (calc_S1 + calc_S2) / 2;
def calc_S3 = L - 2 * (H - calc_PP);
def calc_S2Mid = (calc_S2 + calc_S3) / 2;


plot R3;
plot R2Mid;
plot R2;
plot R1Mid;
plot R1;
plot RMid;
plot PP;
plot SMid;
plot S1;
plot S1Mid;
plot S2;
plot S2Mid;
plot S3;

if (showOnlyToday and !IsNaN(close(period = timeFrame)[-1])) or
(GetAggregationPeriod() > if timeFrame == timeFrame.DAY
                          then AggregationPeriod.DAY
                          else if timeFrame == timeFrame.WEEK
                               then AggregationPeriod.WEEK
                               else AggregationPeriod.MONTH)

then {

    RMid = Double.NaN;

    R1 = Double.NaN;
    R1Mid = Double.NaN;

    R2 = Double.NaN;

    R2Mid = Double.NaN;

    R3 = Double.NaN;

    PP = Double.NaN;

    SMid = Double.NaN;

    S1 = Double.NaN;

    S1Mid = Double.NaN;

    S2 = Double.NaN;

    S2Mid = Double.NaN;

    S3 = Double.NaN;

}
else {

    RMid = calc_RMid;

    R1 = calc_R1;

    R1Mid = calc_R1Mid;

    R2 = calc_R2;

    R2Mid = calc_R2Mid;

    R3 = calc_R3;

    PP = calc_PP;

    SMid = calc_SMid;

    S1 = calc_S1;

    S1Mid = calc_S1Mid;

    S2 = calc_S2;

    S2Mid = calc_S2Mid;

    S3 = calc_S3;

}

RMid.SetDefaultColor(Color.RED);
R1.SetDefaultColor(Color.RED);
R1Mid.SetDefaultColor(color.red);
R2.SetDefaultColor(Color.RED);
R2Mid.SetDefaultColor(color.red);
R3.SetDefaultColor(Color.RED);
SMid.SetDefaultColor(Color.BLUE);
S1.SetDefaultColor(Color.BLUE);
S1Mid.SetDefaultColor(Color.BLUE);
S2.SetDefaultColor(Color.BLUE);
S2Mid.SetDefaultColor(Color.BLUE);
S3.SetDefaultColor(Color.BLUE);

RMid.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R1Mid.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2Mid.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
SMid.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1Mid.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2Mid.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
;

PP.DefineColor("Color", CreateColor(0, 102, 204));
PP.AssignValueColor(PP.Color("Color"));
PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
 
Last edited:
Here is an indicator that plot daily, weekly, and monthly pivot point along with some support and resistance lines on your ThinkorSwim chart. In addition to the three mentioned timeframes, you can also select from 4hr, hourly, etc. This indicator is extremely powerful and useful.

rc8ioP9.png


thinkScript Code

Rich (BB code):
# WeeklyMonthlyPivots_TS
# http://thinkscripter.wordpress.com
# [email protected]
# Last Update 20 APR 2009

input timeFrame = {default WEEK, MONTH};
input showOnlyToday = no;

def H = high(period = timeFrame)[1];
def L = low(period = timeFrame)[1];
def C = close(period = timeFrame)[1];

def calc_PP = (H + L + C) / 3;
def calc_R1 =  (2 * calc_PP) - L;
def calc_R2 = calc_PP + H - L;
def calc_R3 = H + 2 * (calc_PP - L);

def calc_S1 = (2 * calc_PP) - H;
def calc_S2 = calc_PP - H + L;
def calc_S3 = L - 2 * (H - calc_PP);

plot R3;
plot R2;
plot R1;
plot PP;
plot S1;
plot S2;
plot S3;

if (showOnlyToday and !IsNaN(close(period = timeFrame)[-1])) or
(getAggregationPeriod() > if timeframe == timeframe.WEEK then AggregationPeriod.WEEK else AggregationPeriod.MONTH)

then {

    R1 = Double.NaN;
  
    R2 = Double.NaN;
  
    R3 = Double.NaN;
  
    PP = Double.NaN;
  
    S1 = Double.NaN;
  
    S2 = Double.NaN;
  
    S3 = Double.NaN;
 
}
else {
  
 
R1 = calc_R1;
  
    R2 = calc_R2;
  
    R3 = calc_R3;
  
    PP = calc_PP;
  
    S1 = calc_S1;
  
    S2 = calc_S2;
  
    S3 = calc_S3;

}

R1.SetDefaultColor(color.red);
R2.SetDefaultColor(color.red);
R3.SetDefaultColor(color.red);
S1.SetDefaultColor(color.green);
S2.SetDefaultColor(color.green);
S3.SetDefaultColor(color.green);

R1.SetStyle(Curve.POINTS);R2.SetStyle(Curve.POINTS);
R3.SetStyle(Curve.POINTS);
S1.SetStyle(Curve.POINTS);
S2.SetStyle(Curve.POINTS);
S3.SetStyle(Curve.POINTS);

PP.DefineColor("Color", Color.CYAN);
PP.AssignValueColor(PP.color("Color"));
PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

Shareable Link

https://tos.mx/xRWpT3
Hi BenTen, I couldn't find where to set 2H pivots. Am I misreading your description above? Thanks.
 
@Lauri I also could not find a way to use this indicator intraday. I change the description in the first post to reflect that this a monthly/weekly pivot indicator
 
Here is an indicator that plot daily, weekly, and monthly pivot point along with some support and resistance lines on your ThinkorSwim chart.

rc8ioP9.png


thinkScript Code

Rich (BB code):
# WeeklyMonthlyPivots_TS
# http://thinkscripter.wordpress.com
# [email protected]
# Last Update 20 APR 2009

input timeFrame = {default WEEK, MONTH};
input showOnlyToday = no;

def H = high(period = timeFrame)[1];
def L = low(period = timeFrame)[1];
def C = close(period = timeFrame)[1];

def calc_PP = (H + L + C) / 3;
def calc_R1 =  (2 * calc_PP) - L;
def calc_R2 = calc_PP + H - L;
def calc_R3 = H + 2 * (calc_PP - L);

def calc_S1 = (2 * calc_PP) - H;
def calc_S2 = calc_PP - H + L;
def calc_S3 = L - 2 * (H - calc_PP);

plot R3;
plot R2;
plot R1;
plot PP;
plot S1;
plot S2;
plot S3;

if (showOnlyToday and !IsNaN(close(period = timeFrame)[-1])) or
(getAggregationPeriod() > if timeframe == timeframe.WEEK then AggregationPeriod.WEEK else AggregationPeriod.MONTH)

then {

    R1 = Double.NaN;
 
    R2 = Double.NaN;
 
    R3 = Double.NaN;
 
    PP = Double.NaN;
 
    S1 = Double.NaN;
 
    S2 = Double.NaN;
 
    S3 = Double.NaN;
 
}
else {
 
 
R1 = calc_R1;
 
    R2 = calc_R2;
 
    R3 = calc_R3;
 
    PP = calc_PP;
 
    S1 = calc_S1;
 
    S2 = calc_S2;
 
    S3 = calc_S3;

}

R1.SetDefaultColor(color.red);
R2.SetDefaultColor(color.red);
R3.SetDefaultColor(color.red);
S1.SetDefaultColor(color.green);
S2.SetDefaultColor(color.green);
S3.SetDefaultColor(color.green);

R1.SetStyle(Curve.POINTS);R2.SetStyle(Curve.POINTS);
R3.SetStyle(Curve.POINTS);
S1.SetStyle(Curve.POINTS);
S2.SetStyle(Curve.POINTS);
S3.SetStyle(Curve.POINTS);

PP.DefineColor("Color", Color.CYAN);
PP.AssignValueColor(PP.color("Color"));
PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

Shareable Link

https://tos.mx/xRWpT3
anyway to get these with a label or bubble on the side showing if its D/W/M/Q PIVOT sometimes i forget which color is which, also if i wanted to change all pivots to same color but just have the name of each pivot,,
 
For WEEK and MONTH, even if I select show only today, it shows couple, one for current and one for next week. How to restrict it to show for this week only? Thanks

@BenTen For WEEK and MONTH, even if I select show only today, it shows couple, one for current and one for next week. How to restrict it to show for this week only? Thanks
 
For WEEK and MONTH, even if I select show only today, it shows couple, one for current and one for next week. How to restrict it to show for this week only? Thanks

@BenTen For WEEK and MONTH, even if I select show only today, it shows couple, one for current and one for next week. How to restrict it to show for this week only? Thanks

See if this fix in bold works the way you expect

if (showOnlyToday and !IsNaN(close(period = timeFrame)[-1])) or isnan(close) or
(getAggregationPeriod() > if timeframe == timeframe.WEEK then AggregationPeriod.WEEK else AggregationPeriod.MONTH)
Here is the entire code and an example of show only today
Screenshot-2023-02-17-161626.jpg
Code:
# WeeklyMonthlyPivots_TS
# http://thinkscripter.wordpress.com
# [email protected]
# Last Update 20 APR 2009

input timeFrame = {default WEEK, MONTH};
input showOnlyToday = no;

def H = high(period = timeFrame)[1];
def L = low(period = timeFrame)[1];
def C = close(period = timeFrame)[1];

def calc_PP = (H + L + C) / 3;
def calc_R1 =  (2 * calc_PP) - L;
def calc_R2 = calc_PP + H - L;
def calc_R3 = H + 2 * (calc_PP - L);

def calc_S1 = (2 * calc_PP) - H;
def calc_S2 = calc_PP - H + L;
def calc_S3 = L - 2 * (H - calc_PP);

plot R3;
plot R2;
plot R1;
plot PP;
plot S1;
plot S2;
plot S3;

if (showOnlyToday and !IsNaN(close(period = timeFrame)[-1])) or
(getAggregationPeriod() > if timeframe == timeframe.WEEK then AggregationPeriod.WEEK else AggregationPeriod.MONTH)

then {

    R1 = Double.NaN;
 
    R2 = Double.NaN;
 
    R3 = Double.NaN;
 
    PP = Double.NaN;
 
    S1 = Double.NaN;
 
    S2 = Double.NaN;
 
    S3 = Double.NaN;
 
}
else {
 
 
R1 = calc_R1;
 
    R2 = calc_R2;
 
    R3 = calc_R3;
 
    PP = calc_PP;
 
    S1 = calc_S1;
 
    S2 = calc_S2;
 
    S3 = calc_S3;

}

R1.SetDefaultColor(color.red);
R2.SetDefaultColor(color.red);
R3.SetDefaultColor(color.red);
S1.SetDefaultColor(color.green);
S2.SetDefaultColor(color.green);
S3.SetDefaultColor(color.green);

R1.SetStyle(Curve.POINTS);R2.SetStyle(Curve.POINTS);
R3.SetStyle(Curve.POINTS);
S1.SetStyle(Curve.POINTS);
S2.SetStyle(Curve.POINTS);
S3.SetStyle(Curve.POINTS);

PP.DefineColor("Color", Color.CYAN);
PP.AssignValueColor(PP.color("Color"));
PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
 
See if this fix in bold works the way you expect


Here is the entire code and an example of show only today

this morning /es and spy montly and weekly pivots are the same level... is this correct
 
Last edited by a moderator:
Hello. I found this thread
https://usethinkscript.com/threads/weekly-and-monthly-pivots-indicator-for-thinkorswim.152/
and it's sorta what I was looking for but not really for me b/c too noisy. What I do now is manually using the drawing tool: (a) draw a thin price line from top & bottom of previous month (only) going right (to infinity) - usually the first larger "dash" line (- - - - ) and then (b) do the same for the previous week (only), but with the second smaller dash line on the Price line drawing tool. Is there a way to code for something basic like this? thanks for any advice...peace.
 
Last edited by a moderator:
Hello. I found this thread
https://usethinkscript.com/threads/weekly-and-monthly-pivots-indicator-for-thinkorswim.152/
and it's sorta what I was looking for but not really for me b/c too noisy. What I do now is manually using the drawing tool: (a) draw a thin price line from top & bottom of previous month (only) going right (to infinity) - usually the first larger "dash" line (- - - - ) and then (b) do the same for the previous week (only), but with the second smaller dash line on the Price line drawing tool. Is there a way to code for something basic like this? thanks for any advice...peace.

Try this

Code:
#HL_Mon_Week_Extended

input showlast = yes;
input lookback = 1;
input mo_lineweight = 2;
input wk_lineweight = 1;

DefineGlobalColor("H", Color.CYAN);
DefineGlobalColor("L", Color.MAGENTA);

def mohi      = if IsNaN(close(period = AggregationPeriod.MONTH)) then mohi[1] else high(period = AggregationPeriod.MONTH)[lookback];
plot prevmohi = if showlast and GetMonth() != GetLastMonth() then Double.NaN else mohi;
prevmohi.SetStyle(Curve.LONG_DASH);
prevmohi.SetLineWeight(mo_lineweight);
prevmohi.SetDefaultColor(GlobalColor("H"));

def molo      = if IsNaN(close(period = AggregationPeriod.MONTH)) then mohi[1] else low(period = AggregationPeriod.MONTH)[lookback];
plot prevmolo = if showlast and GetMonth() != GetLastMonth() then Double.NaN else molo;
prevmolo.SetStyle(Curve.LONG_DASH);
prevmolo.SetLineWeight(mo_lineweight);
prevmolo.SetDefaultColor(GlobalColor("L"));

def wkhi      = if IsNaN(close(period = AggregationPeriod.WEEK)) then wkhi[1] else high(period = AggregationPeriod.WEEK)[lookback];
plot prevwkhi = if showlast and GetWeek() != GetLastWeek() then Double.NaN else wkhi;
prevwkhi.SetStyle(Curve.SHORT_DASH);
prevwkhi.SetLineWeight(wk_lineweight);
prevwkhi.SetDefaultColor(GlobalColor("H"));


def wklo      = if IsNaN(close(period = AggregationPeriod.WEEK)) then mohi[1] else low(period = AggregationPeriod.WEEK)[lookback];
plot prevwklo = if showlast and GetWeek() != GetLastWeek() then Double.NaN else wklo;
prevwklo.SetStyle(Curve.SHORT_DASH);
prevwklo.SetLineWeight(wk_lineweight);
prevwklo.SetDefaultColor(GlobalColor("L"));
Screenshot 2023-07-09 123310.png
 
@BenTen, @netarchitech thank you for adding the Daily Pivot Points. I was wondering if one can add 2 hour pivot points to put on a smaller time frame chart (10 min, 5 min) to be able to day trade with those alongside with the daily. Any help to add to the code would be most appreciated.

@BenTen I've enhanced the Pivot Point Indicator by adding Daily Pivot Points, so now you can put Daily Pivots on a Hourly chart :) I would suggest a longer time period than 1 day...perhaps 10 or 20 days...

View attachment 4491

Rich (BB code):
# DailyWeeklyMonthlyPivots_TS
# http://thinkscripter.wordpress.com
# [email protected]
# Last Update 11 MAY 2019

input timeFrame = {DAY, default WEEK, MONTH};
input showOnlyToday = no;

def H = high(period = timeFrame)[1];
def L = low(period = timeFrame)[1];
def C = close(period = timeFrame)[1];

def calc_PP = (H + L + C) / 3;
def calc_R1 =  (2 * calc_PP) - L;
def calc_R2 = calc_PP + H - L;
def calc_R3 = H + 2 * (calc_PP - L);

def calc_S1 = (2 * calc_PP) - H;
def calc_S2 = calc_PP - H + L;
def calc_S3 = L - 2 * (H - calc_PP);

plot R3;
plot R2;
plot R1;
plot PP;
plot S1;
plot S2;
plot S3;

if (showOnlyToday and !IsNaN(close(period = timeFrame)[-1])) or
(getAggregationPeriod() > if timeframe == timeframe.DAY
                          then AggregationPeriod.DAY
                          else if timeframe == timeframe.WEEK
                               then AggregationPeriod.WEEK
                               else AggregationPeriod.MONTH)

then {

    R1 = Double.NaN;
   
    R2 = Double.NaN;
   
    R3 = Double.NaN;
   
    PP = Double.NaN;
   
    S1 = Double.NaN;
   
    S2 = Double.NaN;
   
    S3 = Double.NaN;
  
}
else {
   
  
 R1 = calc_R1;
   
    R2 = calc_R2;
   
    R3 = calc_R3;
   
    PP = calc_PP;
   
    S1 = calc_S1;
   
    S2 = calc_S2;
   
    S3 = calc_S3;

}

R1.SetDefaultColor(color.red);
R2.SetDefaultColor(color.red);
R3.SetDefaultColor(color.red);
S1.SetDefaultColor(color.green);
S2.SetDefaultColor(color.green);
S3.SetDefaultColor(color.green);

R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);;

PP.DefineColor("Color", CreateColor(0, 102, 204));
PP.AssignValueColor(PP.color("Color"));
PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Hope this helps...

Good Luck and Good Trading :)
 
@eka : For some unknown reason, the previous Pivot Point code set to a TWO HOURS timeframe would not plot on a minute chart. However, I did find the following script in the Default TOS Studies list under "SVE Pivots", if you would like to try it out. I set it to a TWO HOURS timeframe default. I tested it and it does plot two hour pivot points on minute charts...

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2018-2023
#

input aggregationPeriod = AggregationPeriod.TWO_HOURS;

def PH = high(period = aggregationPeriod)[1];
def PL = low(period = aggregationPeriod)[1];
def PC = close(period = aggregationPeriod)[1];

plot R3;
plot R3M;
plot R2;
plot R2M;
plot R1;
plot R1M;
plot HH;
plot PP;
plot LL;
plot S1M;
plot S1;
plot S2M;
plot S2;
plot S3M;
plot S3;

HH = PH;
LL = PL;
PP = (PH + PL + PC) / 3;
R1 = 2 * PP - PL;
R1M = (R1 - PP) / 2 + PP;
R2 = PP + (PH - PL);
R2M = (R2 - R1) / 2 + R1;
R3 = 2 * PP + (PH - 2 * PL);
R3M = (R3 - R2) / 2 + R2;
S1 = 2 * PP - PH;
S1M = (PP - S1) / 2 + S1;
S2 = PP - (PH - PL);
S2M = (S1 - S2) / 2 + S2;
S3 = 2 * PP - (2 * PH - PL);
S3M = (S2 - S3) / 2 + S3;

R3.SetDefaultColor(GetColor(5));
R3M.SetDefaultColor(GetColor(5));
R2.SetDefaultColor(GetColor(5));
R2M.SetDefaultColor(GetColor(5));
R1.SetDefaultColor(GetColor(5));
R1M.SetDefaultColor(GetColor(5));
HH.SetDefaultColor(GetColor(4));
PP.SetDefaultColor(GetColor(0));
LL.SetDefaultColor(GetColor(1));
S1.SetDefaultColor(GetColor(6));
S1M.SetDefaultColor(GetColor(6));
S2.SetDefaultColor(GetColor(6));
S2M.SetDefaultColor(GetColor(6));
S3.SetDefaultColor(GetColor(6));
S3M.SetDefaultColor(GetColor(6));

R3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R3M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R1M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
HH.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
LL.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

R3M.SetStyle(Curve.SHORT_DASH);
R2M.SetStyle(Curve.SHORT_DASH);
R1M.SetStyle(Curve.SHORT_DASH);
HH.SetStyle(Curve.MEDIUM_DASH);
LL.SetStyle(Curve.MEDIUM_DASH);
S1M.SetStyle(Curve.SHORT_DASH);
S2M.SetStyle(Curve.SHORT_DASH);
S3M.SetStyle(Curve.SHORT_DASH);

R3M.Hide();
R2M.Hide();
R1M.Hide();
HH.Hide();
LL.Hide();
S1M.Hide();
S2M.Hide();
S3M.Hide();

Hope this helps...

Good Luck and Good Trading :cool:
 
@eka : For some unknown reason, the previous Pivot Point code set to a TWO HOURS timeframe would not plot on a minute chart. However, I did find the following script in the Default TOS Studies list under "SVE Pivots", if you would like to try it out. I set it to a TWO HOURS timeframe default. I tested it and it does plot two hour pivot points on minute charts...

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2018-2023
#

input aggregationPeriod = AggregationPeriod.TWO_HOURS;

def PH = high(period = aggregationPeriod)[1];
def PL = low(period = aggregationPeriod)[1];
def PC = close(period = aggregationPeriod)[1];

plot R3;
plot R3M;
plot R2;
plot R2M;
plot R1;
plot R1M;
plot HH;
plot PP;
plot LL;
plot S1M;
plot S1;
plot S2M;
plot S2;
plot S3M;
plot S3;

HH = PH;
LL = PL;
PP = (PH + PL + PC) / 3;
R1 = 2 * PP - PL;
R1M = (R1 - PP) / 2 + PP;
R2 = PP + (PH - PL);
R2M = (R2 - R1) / 2 + R1;
R3 = 2 * PP + (PH - 2 * PL);
R3M = (R3 - R2) / 2 + R2;
S1 = 2 * PP - PH;
S1M = (PP - S1) / 2 + S1;
S2 = PP - (PH - PL);
S2M = (S1 - S2) / 2 + S2;
S3 = 2 * PP - (2 * PH - PL);
S3M = (S2 - S3) / 2 + S3;

R3.SetDefaultColor(GetColor(5));
R3M.SetDefaultColor(GetColor(5));
R2.SetDefaultColor(GetColor(5));
R2M.SetDefaultColor(GetColor(5));
R1.SetDefaultColor(GetColor(5));
R1M.SetDefaultColor(GetColor(5));
HH.SetDefaultColor(GetColor(4));
PP.SetDefaultColor(GetColor(0));
LL.SetDefaultColor(GetColor(1));
S1.SetDefaultColor(GetColor(6));
S1M.SetDefaultColor(GetColor(6));
S2.SetDefaultColor(GetColor(6));
S2M.SetDefaultColor(GetColor(6));
S3.SetDefaultColor(GetColor(6));
S3M.SetDefaultColor(GetColor(6));

R3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R3M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R1M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
HH.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
LL.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

R3M.SetStyle(Curve.SHORT_DASH);
R2M.SetStyle(Curve.SHORT_DASH);
R1M.SetStyle(Curve.SHORT_DASH);
HH.SetStyle(Curve.MEDIUM_DASH);
LL.SetStyle(Curve.MEDIUM_DASH);
S1M.SetStyle(Curve.SHORT_DASH);
S2M.SetStyle(Curve.SHORT_DASH);
S3M.SetStyle(Curve.SHORT_DASH);

R3M.Hide();
R2M.Hide();
R1M.Hide();
HH.Hide();
LL.Hide();
S1M.Hide();
S2M.Hide();
S3M.Hide();

Hope this helps...

Good Luck and Good Trading :cool:
Thank you
@eka : For some unknown reason, the previous Pivot Point code set to a TWO HOURS timeframe would not plot on a minute chart. However, I did find the following script in the Default TOS Studies list under "SVE Pivots", if you would like to try it out. I set it to a TWO HOURS timeframe default. I tested it and it does plot two hour pivot points on minute charts...

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2018-2023
#

input aggregationPeriod = AggregationPeriod.TWO_HOURS;

def PH = high(period = aggregationPeriod)[1];
def PL = low(period = aggregationPeriod)[1];
def PC = close(period = aggregationPeriod)[1];

plot R3;
plot R3M;
plot R2;
plot R2M;
plot R1;
plot R1M;
plot HH;
plot PP;
plot LL;
plot S1M;
plot S1;
plot S2M;
plot S2;
plot S3M;
plot S3;

HH = PH;
LL = PL;
PP = (PH + PL + PC) / 3;
R1 = 2 * PP - PL;
R1M = (R1 - PP) / 2 + PP;
R2 = PP + (PH - PL);
R2M = (R2 - R1) / 2 + R1;
R3 = 2 * PP + (PH - 2 * PL);
R3M = (R3 - R2) / 2 + R2;
S1 = 2 * PP - PH;
S1M = (PP - S1) / 2 + S1;
S2 = PP - (PH - PL);
S2M = (S1 - S2) / 2 + S2;
S3 = 2 * PP - (2 * PH - PL);
S3M = (S2 - S3) / 2 + S3;

R3.SetDefaultColor(GetColor(5));
R3M.SetDefaultColor(GetColor(5));
R2.SetDefaultColor(GetColor(5));
R2M.SetDefaultColor(GetColor(5));
R1.SetDefaultColor(GetColor(5));
R1M.SetDefaultColor(GetColor(5));
HH.SetDefaultColor(GetColor(4));
PP.SetDefaultColor(GetColor(0));
LL.SetDefaultColor(GetColor(1));
S1.SetDefaultColor(GetColor(6));
S1M.SetDefaultColor(GetColor(6));
S2.SetDefaultColor(GetColor(6));
S2M.SetDefaultColor(GetColor(6));
S3.SetDefaultColor(GetColor(6));
S3M.SetDefaultColor(GetColor(6));

R3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R3M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R1M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
HH.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
LL.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

R3M.SetStyle(Curve.SHORT_DASH);
R2M.SetStyle(Curve.SHORT_DASH);
R1M.SetStyle(Curve.SHORT_DASH);
HH.SetStyle(Curve.MEDIUM_DASH);
LL.SetStyle(Curve.MEDIUM_DASH);
S1M.SetStyle(Curve.SHORT_DASH);
S2M.SetStyle(Curve.SHORT_DASH);
S3M.SetStyle(Curve.SHORT_DASH);

R3M.Hide();
R2M.Hide();
R1M.Hide();
HH.Hide();
LL.Hide();
S1M.Hide();
S2M.Hide();
S3M.Hide();

Hope this helps...

Good Luck and Good Trading :cool:
@netarchitech, thank you. I will try that. Appreciate your help.
 

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
590 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