StockFetcher Forums · General Discussion · CODING A "PIVOT HIGH"<< >>Post Follow-up
graftonian
1,089 posts
msg #134360
Ignore graftonian
modified
2/16/2017 6:03:56 PM

Trying to write code to find the most recent pivot high among the last 5 candles. My definition of pivot high is a high preceded, and followed, by a lower high. By definition it can only be the 2nd, 3rd, or 4th candle; if it exists at all. Any help would be greatly appreciated.
For a look at what I am working on, check out:

www.youtube.com/watch?v=ji0bEjhUReg&t=3172s


Thanx

graftonian
1,089 posts
msg #134370
Ignore graftonian
2/17/2017 11:59:05 AM

if anyone is interested. It is a bit "clunky" but it works (I think)
Fetcher[
/*code for 5 day pivot high*/
market market is not OTCBB
close > .50
Average Volume(30) > 100000
draw bollinger band(20, 0.382)
set{X, count(close > Upper Bollinger Band(20, 0.382), 5)}
x equals 5
draw x
close 5 days ago < Upper Bollinger Band(20, .382) 5 days ago
close 6 days ago < Upper Bollinger Band(20, .382) 6 days ago
close 7 days ago < Upper Bollinger Band(20, .382) 7 days ago
close 8 days ago < Upper Bollinger Band(20, .382) 8 days ago
chart-time is 30 days
add column separator
set{D2_A, count(high 1 day ago > high, 1)}
set{D2_B, count(high 1 day ago > high 2 days ago, 1)}
set{D2_C, D2_A + D2_B}
set{D2_D, D2_C - 1}
set{D2_HIGH, D2_D * high 1 day ago}
add column D2_HIGH

set{D3_A, count(high 2 days ago > high 1 day ago, 1)}
set{D3_B, count(high 2 days ago > high 3 days ago, 1)}
set{D3_C, D3_A + D3_B}
set{D3_D, D3_C - 1}
set{D3_HIGH, D3_D * high 2 days ago}
add column D3_HIGH

set{D4_A, count(high 3 days ago > high 2 days ago, 1)}
set{D4_B, count(high 3 days ago > high 4 days ago, 1)}
set{D4_C, D4_A + D4_B}
set{D4_D, D4_C - 1}
set{D4_HIGH, D4_D * high 3 days ago}
add column D4_HIGH

set{piv_hi_01, max(D2_HIGH, D3_HIGH)}
set{pivot_high, max(piv_hi_01, D4_HIGH)}
add column separator
add column pivot_high
draw price line at pivot_high
]



StockFetcher Forums · General Discussion · CODING A "PIVOT HIGH"<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.