hi = pc and hlv == -1 ? sma(high, periods) : na lo = pc and hlv == 1 ? sma(low,periods) : na plot(avg(sma(high,periods)+2.5*(sma(high,periods)-sma(low,periods)),sma(low,periods)-2.5*(sma(high,periods)-sma(low,periods))), color=navy, style=line,linewidth=3) plot(pc and sma(high, periods) ? sma(high, periods):na ,title="Swing High Plot", color=black,style=line, linewidth=3) plot(pc and sma(low,periods) ? sma(low,periods) : na ,title="Swing Low Plot", color=black,style=line, linewidth=3)
//--------------------------------------------------------------------------------------------- //CM_Gann Swing HighLow V2/Modified////// MA input NOT WORKING !!!! ? periods2=input(9, minval=1, title="Moving Average Period") pttb = input(true, title="Trend Indicator") //shb = input(false) sbh = input(false, title="Background MA crossover bars") //code for Calculations hld2 = iff(close > sma(high,periods)[1], 1, iff(close<sma(low,periods)[1],-1, 0)) hlv2 = valuewhen(hld2 != 0, hld2, 1) //code for Plot Statements hi2 = hlv2 == -1 ? sma(high, periods) : na lo2 = hlv2 == 1 ? sma(low,periods) : na
//Rules for coloring Background highlights & Highlight Bars //closeAbove() => shb and close > hi2 and close[1] < hi2 BHcloseAbove = sbh and close > hi2 and close[1] < hi2 //closeBelow() => shb and close < lo2 and close[1] > lo2 BHcloseBelow = sbh and close < lo2 and close[1] > lo2
bgcolor(BHcloseAbove ? green : na, transp=60) bgcolor(BHcloseBelow ? red : na, transp=60)
plotshape(pttb and hi2 ? hi2: 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 lo2 ? lo2 : na, title="Gann Swing Low Plots-Triangles Up Bottom of Screen",offset=0, style=shape.triangleup, location=location.top, color=lime, transp=0) //======================================================= //study("Vdub_Tetris_V2", overlay=true) Sml_Channel_TF_mins_D_W_M = input("W") Range2 = input(1)