Get Updates:
Email
Twitter
RSS

Here’s a Friday night quickie for the masses. I posted this in the forum earlier in the week. This is just the basic weekly and and monthly pivots with a slight improvement. If you’ve used the TOS pivots you might have noticed that the weekly and monthly pivots don’t behave as expected. Rather than stay the same for a whole month or week, they change on a daily basis. Many of us want weekly and monthly pivots that remain constant for the whole period. If you fall into that category, then these pivots are for you. The pivots are always calculated on all the available data which means 24Hr data for futures.

ThinkScripter Pivots

ThinkScripter Pivots

# TS_Pivots
# (c) 2009 http://www.thinkscripter.com
# thinkscripter@gmail.com
# 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;
}

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

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

8 Responses to “Weekly/Monthly Pivots”

  1. Dan Robbins says:

    I’ve never noticed my weekly/monthly pivots moving, but then again, I’m viewing them on the chart and not checking the level each day. Also, I use the Person Pivots, not the TOS pivots – is there a difference there?

    • You are correct in that Person’s Pivots do not change. TOS’ default pivots do. The pivots here are just basic floor trader’s pivots (like TOS’) but that don’t recalculate every day.

  2. Eric says:

    So is this basically calculating the current week’s pivot points from all of the prior week’s data? Also, why is it that TOS’s pivot points would trade with each added day? Was it just based on a rolling prior-week basis (simply the week starting from the day right b4 the current day)?

    Thanks in advance!

    • Yes, if you plot the TOS weekly or monthly pivots they change every day (or at least they did when I wrote this! I haven’t been back to check in some time) so it is a rolling week or month. Mine are static for the trading week or month and then change.
      -Eric

  3. Eric says:

    Sorry, in my last comment, the word ‘trade’ on the second line should be replaced with ‘change’

  4. Eric says:

    Also, last issue. In comparing this study to the TOS Pivot Points (on a daily timeframe), it seems that there is a discrepancy between the R3/S3 levels. The other Support/Resistance levels match up between both your study as well as TOS’s. The only difference comes in the third levels. Was wondering if you knew why. Thanks again for all you do!

    • Oh dear….I updated this code some time ago to remove the Daily timeframe altogether as it is not correct. There is no need for this study to have the daily pivots as TOS’ study works just fine there. I have now updated the code to be correct. Thanks!
      -Eric

Leave a Reply