Hey @BenTen is there a way to use this for futures. When I use on the 5 day 5 minute chart the CPR ranges are not accurate when comparing them to the trading view CPR values.
Hey @BenTen is there a way to use this for futures. When I use on the 5 day 5 minute chart the CPR ranges are not accurate when comparing them to the trading view CPR values.
TradingView calculates the central pivot as (high + low + settlement price) / 3.
(15,340.25 + 14,646.75 + 14,841.00) / 3 = $14,942
ThinkOrSwim calculates the central pivot as (high + low + close price) / 3
(15,340.25 + 14,646.75 + 14,725.75) / 3 = $14,904
There is a way to get thinkorswim to calculate the pivot the same way as trading view. You'll want to create a new input to let the user enter settlement price, then change the code to use the input value as part of the calculation.
I've implemented a basic version below.
Code:
# CPR with Settlement
# by bigboss
#
# Some platforms, like Trading View, calculate CPR and pivots for futures using "settlement" price.
# Thinkorswim uses the "last" price.
# Override the price used for close with the settlement price input. Values can be found on the
# CME group website.
input settlement_price = 0.00;
input period = AggregationPeriod.DAY;
def h = high(period=period)[1];
def l = low(period=period)[1];
def c = if settlement_price > 0 then settlement_price else close(period=period)[1];
plot cp = (h + l + c)/3;
def _bc = (h + l)/2;
def _tc = (cp - _bc) + cp;
plot tc = max(_bc,_tc);
plot bc = min(_bc,_tc);
cp.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
tc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
cp.SetDefaultColor(Color.MAGENTA);
tc.SetDefaultColor(Color.VIOLET);
bc.SetDefaultColor(Color.VIOLET);
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.
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.