NexusFi: Find Your Edge


Home Menu

 





Trying to Create a Local Maximum Pivot Indicator using ThinkScript


Discussion in ThinkOrSwim

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




 
Search this Thread
  #1 (permalink)
SquillyD
El Paso Texas/USA
 
Posts: 2 since Apr 2014
Thanks Given: 0
Thanks Received: 0

Hello all,
I’ve been working on trying to create an indicator that would show a dot above a local maximum pivot point. I’m defining these pivot highs as a bar that has a higher high than the bar that came before it and the bar that comes after it.
If we define:

N – as the current (right from middle) bar,
N-1 – as the previously closed (middle) bar, and finally,
N-2 – as the bar to the left of the middle bar

Logically speaking, I’m thinking the code should be something similar to this:

N-1 > N and N-2

As the indicator is going through and looking over each set of 3 bars, it’s determining if the N-1 bar is greater than the N and N-2 bars. I’ve tried a number of ways to program this concept but no luck so far

There is probably many easy ways to accomplish this but I'm having trouble doing so.


Attached Thumbnails
Click image for larger version

Name:	NG_1.png
Views:	306
Size:	65.8 KB
ID:	186105  
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
No book, only a stair: journaling fills where price move …
Cryptocurrency
Datafeed for Atas
Platforms and Indicators
Trump Media to sell instant access to market-moving soci …
Traders Hideout
My Rant with AMP Futures
Trading Reviews and Vendors
EA
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Mes vs MNQ
6 thanks
NexusFi site changelog and issues/problem reporting
5 thanks
BERN ALGOS algo trading journal
3 thanks
Johnnys Journal
2 thanks
TopStep Trader disappointment
2 thanks
  #2 (permalink)
SquillyD
El Paso Texas/USA
 
Posts: 2 since Apr 2014
Thanks Given: 0
Thanks Received: 0

The code for this actually turned out to be pretty simple to right! It took me a few hours though to figure out how to express this in the syntax:

plot pivotH_1st = high[-1] < high && high > high[1];
plot pivotL_1st = low[-1] > low && low < low[1];
pivotH_1st.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
pivotL_1st.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);


(Included image shows the results)

Now I want to take this script to the next level and use the 1st order pivot highs and lows as inputs for the 2nd order pivots. The logic in the first post explains (at least I think it does). How would I store the values of the 1st order pivots so that they can be used to calculate the second round of pivots? Any ideas would be greatly appreciated!


Attached Thumbnails
Click image for larger version

Name:	NG2.png
Views:	380
Size:	60.9 KB
ID:	186230  
Reply With Quote




Last Updated on July 2, 2015


© 2026 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 - Downloads - Top
no new posts