Pivot indicator works well, need explanation based on code - ThinkOrSwim Programming | futures io social trading
futures io futures trading

Pivot indicator works well, need explanation based on code
Updated: Views / Replies:461 / 1
Created: by jake0alexander Attachments:0

Welcome to futures io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

Pivot indicator works well, need explanation based on code

  #1 (permalink)
Elite Member
New York, New York, USA
Futures Experience: Intermediate
Platform: ThinkOrSwim
Favorite Futures: Stocks, Options, Futures
Posts: 5 since Jan 2015
Thanks: 2 given, 2 received

Pivot indicator works well, need explanation based on code

I just found a site that hasn't been updated in a while but had an interesting pivot indicator I wanted to check out. I threw it up on a few charts and it seems to work really well for futures but not so much for stocks. It looks like it calculates the previous days high and low as well as the over night high and low and creates pivots based on those (although it doesn't seem exact). That's just from looking though. I attempted to decipher some of the code, but I have zero knowledge there. I'd really appreciate if someone could explain to me exactly what this indicator does based on the code which you can find here...


TLDR; explain what this indicator does based on the code please

Reply With Quote
  #2 (permalink)
1.Fibs 2.??? 3.Profit
Puerto Rico
Futures Experience: Intermediate
Platform: thinkorswim
Broker/Data: TD Ameritrade
Favorite Futures: ES
rmejia's Avatar
Posts: 384 since Oct 2010
Thanks: 3,597 given, 420 received

The meat of the code is this (the rest is mostly formatting: colors, linetype, hiding):

input _high  = 1043.75;
input _low   = 1033.50;
input settle = 1041.50;

    PP = (_high + _low + settle) / 3;
    R1 = (2 * PP) - _low;
    S1 = (2 * PP) - _high;
    R2 = PP + (r1 - s1);
    S2 = PP - (r1 - s1);
    R3 = _high + 2 * (PP - _low);
    S3 = _low - 2 * (_high - PP);

Inputs are what you manually enter, in this case it is 3 parameters, _high, _low & settle. Previous day, high, low and close.

For the plots there are 7:
PP = Pivot Point
R1 = Resistance 1
S1 = Support 1

The formula is just substituting the abbreviations for the numbers:
PP = (_high + _low + settle) / 3;

_high, _low & settle are the inputs you manually entered. It is adding them and then dividing by 3. That value is PP which is then plotted.

PP = (1043.75 + 1033.50 + 1041.50) / 3
PP = 1,039.58

It calculates PP first to use it on the next plot:

R1 = (2 * PP) - _low;

In this one it is multiplying 2 times the value of PP it just calculated, then subtracting that to the manual input _low.

R1 = (2 * 1,039.58) - 1033.50
R1 = 1,045.66

The rest is the same; just substituting the names (PP,R1,etc) for the values.

Reply With Quote
The following 2 users say Thank You to rmejia for this post:


futures io > > > > > Pivot indicator works well, need explanation based on code

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

FIO Journal Challenge featuring NinjaTrader ($2,000+ of prizes)


Prototyping Python Strategies (part 2: Backtesting) w/Ran Aroussi [special time: 1PM ET]

Elite only

Portfolio Diversification w/Brendon Delate @ Diversify Portfolio

Elite only

An Afternoon with FIO member Softsoap (being rescheduled)

Elite only

Similar Threads
Thread Thread Starter Forum Replies Last Post
pivot point code... rmiller863 ThinkOrSwim 15 December 27th, 2015 10:00 PM
EL Trend Line based on Pivot Phillo82 EasyLanguage Programming 1 October 14th, 2013 10:45 AM
Help adding a Pivot Range to following code: olobay MultiCharts 3 September 18th, 2012 09:07 AM
MACD_Zero Lag Indicator Explanation GilR NinjaTrader 4 February 25th, 2011 06:36 AM
BMT CCI Pivot Zone easylanguage code for Market Delta? kienow Investor/RT 1 February 16th, 2011 02:37 PM

All times are GMT -4. The time now is 10:05 AM.

Copyright © 2017 by futures io, s.a. Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-05-24 in 0.09 seconds with 19 queries on phoenix via your IP