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

Go Back   futures.io

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > ThinkOrSwim > ThinkOrSwim Programming


Pivot indicator works well, need explanation based on code
Started:February 10th, 2015 (02:21 PM) by jake0alexander Views / Replies:377 / 1
Last Reply:February 10th, 2015 (09:09 PM) 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
     

Reply
 
Thread Tools Search this Thread

Pivot indicator works well, need explanation based on code

Old February 10th, 2015, 02:21 PM   #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...

http://shadowtrader.net/images/thinkscript_STpivots.txt

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

Reply With Quote
     

Old February 10th, 2015, 09:09 PM   #2 (permalink)
1.Fibs 2.??? 3.Profit
Puerto Rico
 
Futures Experience: Intermediate
Platform: thinkorswim
Broker/Data: TD Ameritrade
Favorite Futures: CL
 
rmejia's Avatar
 
Posts: 381 since Oct 2010
Thanks: 3,547 given, 415 received

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
     
The following 2 users say Thank You to rmejia for this post:
     

Reply



futures.io > Futures Trading, News, Charts and Platforms > Platforms and Indicators > ThinkOrSwim > ThinkOrSwim Programming > 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)
 

NinjaTrader 8: Features and Enhancements, Tips and Tricks

Dec 6
 

Al Brooks: Stop Losing when a Good Trade goes Bad, Correcting Mistakes

Elite only
 

Trading Technologies: Algo Design Lab hands-on

Dec 13
     

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


All times are GMT -4. The time now is 04:11 AM.

Copyright © 2016 by 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 2016-12-06 in 0.08 seconds with 19 queries on phoenix via your IP 54.163.147.69