Last active
December 6, 2022 06:41
-
-
Save sherwind/42e2313a5d0a3685f0d24cf8dc4734fa to your computer and use it in GitHub Desktop.
ZigZag HiLo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@version=3 | |
// | |
// Based on http://traders.com/documentation/feedbk_docs/2013/07/traderstips.html | |
// | |
// | |
// ----------------------------------------------------------------------------- | |
// Copyright 2018 sherwind | |
// | |
// This program is free software: you can redistribute it and/or modify | |
// it under the terms of the GNU General Public License as published by | |
// the Free Software Foundation, either version 3 of the License, or | |
// any later version. | |
// | |
// This program is distributed in the hope that it will be useful, | |
// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
// GNU General Public License for more details. | |
// | |
// The GNU General Public License can be found here | |
// <http://www.gnu.org/licenses/>. | |
// | |
// ----------------------------------------------------------------------------- | |
// | |
study("ZigZag HiLo", overlay=true) | |
ZZPercent = input(0.5, title="Minimum % Change", type=float) | |
trend = 0 | |
trend := na(trend[1]) ? 1 : trend[1] | |
LL = 0.0 | |
LL := na(LL[1]) ? low : LL[1] | |
HH = 0.0 | |
HH := na(HH[1]) ? high : HH[1] | |
PivotChg = ZZPercent * 0.01 | |
zigzag = na | |
if (trend > 0) // trend is up, look for new swing low | |
if (high >= HH) // new higher high detected | |
HH := high | |
else | |
if (low < HH * (1 - PivotChg)) | |
zigzag := high[1] | |
trend := -1 | |
LL := low | |
else // trend is down, look for new swing high | |
if (low <= LL) // new lower low detected | |
LL := low | |
else | |
if (high > LL * (1 + PivotChg)) | |
zigzag := low[1] | |
trend := 1 | |
HH := high | |
plot(zigzag, linewidth=2, offset=-1) |
Must be a copy-pasting issue. Try this instead
https://www.tradingview.com/script/7cywfVQb-ZigZag-HiLo/
…On Tue, Jun 18, 2019, 3:46 AM Hanhan Chen ***@***.***> wrote:
thanks , but , I get this error:
Processing script...
line 40: mismatched input 'HH' expecting 'end of line without line continuation'
can you solve it? Thanks
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/42e2313a5d0a3685f0d24cf8dc4734fa?email_source=notifications&email_token=AACRP7XN7HQE6MDWVKMFS4TP27S27A5CNFSM4HYZWM7KYY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAFT2M2#gistcomment-2946253>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AACRP7SBTTHDRNHPPRPFRQ3P27S27ANCNFSM4HYZWM7A>
.
Hello sir, how we can add this pine code to timeframe?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks , but , I get this error:
can you solve it? Thanks