NexusFi: Find Your Edge


Home Menu

 





Pivot indicator works well, need explanation based on code


Discussion in ThinkOrSwim

Updated
    1. trending_up 2,712 views
    2. thumb_up 2 thanks given
    3. group 1 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread

Pivot indicator works well, need explanation based on code

  #1 (permalink)
 jake0alexander 
New York, New York, USA
 
Experience: Intermediate
Platform: ThinkOrSwim
Trading: Stocks, Options, Futures
Posts: 5 since Jan 2015
Thanks Given: 2
Thanks Received: 2

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

https://www.shadowtrader.net/images/thinkscript_STpivots.txt

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

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
REcommedations for programming help
Sierra Chart
NexusFi Journal Challenge - May 2024
Feedback and Announcements
Quant vue
Trading Reviews and Vendors
Better Renko Gaps
The Elite Circle
 
  #2 (permalink)
 
rmejia's Avatar
 rmejia 
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441

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

 
Code
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
etc.

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
Thanked by:




Last Updated on February 10, 2015


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts