ChrisMoody

CM_Gann_Swing_HighLow

8169 visualizzazioni
1256
8169 16
Custom Indicator - Gann Swing High Low

Uses New Plot Types

Inputs Tab Options:

Use Up/Down Arrows - Or Circles!

Turn Up/Down Arrows at Top and Bottom of Screen On/Off

New Top/Bottom of Screen Plot Types

New Up/Down Arrow Plot Types

Full Credit Goes to Glaz for Creating Code.

Created By Request for @dvk1970
Rimuovi dagli script preferiti Aggiungi agli script preferiti
//Created 99% by Glaz and ChrisMoody Modified about 1% on 7/30/2014 for user dvk197-

study("CM_Gann_Swing_Highlow",overlay=true)
periods=input(3, minval=1, title="Moving Average Period")
pt = input(true, title="Plot Up/Down Triangles at Top and Bottom of Candles/Bars?")
pc = input(false, title="Plot Circles at Top and Bottom of Candles/Bars?")
pttb = input(true, title="Plot Triangles at Top and Bottom of Screen?")
//code for Calculations
hld = iff(close > sma(high,periods)[1], 1, iff(close<sma(low,periods)[1],-1, 0))
hlv = valuewhen(hld != 0, hld, 1)
//code for Plot Statements
hi = hlv == -1 ? sma(high, periods) : na
lo = hlv == 1 ? sma(low,periods) : na
//Plot Statements for circles and Triangle Up/Down at Price Bars
plot(pc and hi ? hi : na,title="Gann Swing High Plots-Circles", color=fuchsia,style=circles, linewidth=4)
plot(pc and lo ? lo : na,title="Gann Swing Low Plots-Circles", color=lime,style=circles, linewidth=4)
plotshape(pt and hi ? hi : na,title="Gann Swing High Plots-Triangle Down", offset=0, style=shape.triangledown, location=location.abovebar, color=fuchsia, transp=0)
plotshape(pt and lo ? lo : na,title="Gann Swing Low Plots-Triangle Up", offset=0, style=shape.triangleup, location=location.belowbar, color=lime, transp=0)
//Plot Statement for Triangles at Top and Bottom of Screen
plotshape(pttb and hi ? hi : na,title="Gann Swing High Plots-Triangles Down Top of Screen", offset=0, style=shape.triangledown, location=location.top, color=red, transp=0)
plotshape(pttb and lo ? lo : na, title="Gann Swing Low Plots-Triangles Up Bottom of Screen",offset=0, style=shape.triangleup, location=location.bottom, color=lime, transp=0)
Hi! 10Q! Why 2nd LHLL bar is green?
Rispondi
ChrisMoody Routcheau
@Routcheau, If you don't mind...be more specific...are you talking about the chart above or on a different chart? Just give me the exact date your referring to either on the chart above...or the date and Symbol and TimeFrame if your talking about a different chart.
Rispondi
Routcheau ChrisMoody
@ChrisMoody,
How much breakouts change the color?

There's an EMA.
(Why not SMA by the way? Not the most important question!!!)

Can I manipulate through that EMA :
One bar breakout to change the color (EMA2 ?)
Two bars breakout to change the color (EMA3 ?)—*
Three bars breakout to change the color (EMA4 ?)

*— In the script I see "3 periods"
Do they change the color for 2_breakout_bars_swing ?
I guess ema's minimum period 2 means "one bar Hi/Lo breakout" etc.
Rispondi
All you work is greatly appreciated! I'm new to PINE, trying to learn it by reading others codes and have a question. Using this code as an example, how would I execute plot or plotshape so it only draws the cirle/ triangle once while it is in the same direction. In other words, it only plots when it flips? Thanks in advance for any assistance you can offer.
Rispondi
ChrisMoody pipCharlie
You would create a True False condition...which I did...but you would want the True/False condition to be True only once like a Cross...I have a code somewhere where TheLark labeled something as a Cross that really wasn't technically a cross. I'll look it up when I get a chance...If I haven't answered you by Tuesday morning PM me and remind me or ask me to answer below.

Want to make sure you have these references...:
https://www.tradingview.com/study-script-reference
https://docs.google.com/document/d/1sCfC873xJEMV7MGzt1L70JTStTE9kcG2q-LDuWWkBeY/edit?pli=1
Rispondi
ChrisMoody ChrisMoody
Check out the end of TheLarks Code

at the end of the code before the Plot statements add

up = hlv == -1 ? sma(high, periods) : na
down = lo ? 1 : 0
up2 = hi ? 1 : 0
down2 = hlv == 1 ? sma(low,periods) : na

And // out the other two plot shape statements and add these below those.

plotshape(cross(up,down) ? hi : na,title="Gann Swing High Plots-Triangle Down", offset=0, style=shape.triangledown, location=location.abovebar, color=fuchsia, transp=0)
plotshape(cross(up2,down2) ? lo : na,title="Gann Swing Low Plots-Triangle Up", offset=0, style=shape.triangleup, location=location.belowbar, color=lime, transp=0)

Ideally you would want to use the plotarrow command but I couldn't get that to work correctly
Rispondi
pipCharlie ChrisMoody
AWESOME Chris, thanks. We give it a try.
Rispondi
@chris ok thanks to Glaz for the coding great job thanks!
Rispondi
again job well done....thx u again for are the hard work u have done to bring all us this wonder indicators....
Rispondi
Basic rules Gann swing trading. To buy there must be a Gann uptrend, so the price should be higher than the last high. The HiLo activator will sit as a stop loss below the bar. If the price of has been in a rising trend ,but the closing price was below the HiLo activator (eg in a correective phase), then we buy when a closing price above the HiLo activator is put down. The rules to sell are the opposite. Selling we do when the Gann swing trading method turns from rising to declining (gann Down Trend, there has been a lower low) or if the Gann swing is already falling , by breaking the HiLo activator. Stops and profit protection. For a long position we take profit of all contracts if the price closes below the HiLo activator. The 38% retracement rule: take profit on all contracts with a 38% correction (Fibbonacci percentage) of the current swing, in this case we dont wait for the closing price. Suppose we are talking about an upswing , an uptrend from A to B. For example if the current price than retraces 38% of the distance AB and also below the HiLo activator, we must exit the market and not wait for the closing.
+2 Rispondi
Home Screener azioni Screener forex Screener cripto Calendario economico Show Come funziona Caratteristiche Grafico Costi Regolamento Maghi del Pine Moderatori Soluzioni per broker & siti web Widget Librerie grafiche Libreria grafica leggera Centro di supporto Invita un amico Suggerisci funzionalità Blog & Novità Twitter
Profilo Impostazioni profilo Account e fatturazione Invita un amico I miei ticket di supporto Centro di supporto Idee pubblicate Follower Seguiti Messaggi Privati Chat Esci