//Modified //ALL SWING HIGH LOW study(title="prev swing ohlc", shorttitle="All swings in one ", overlay=true) st = input(false, title="Show Todays OHLC?") sy = input(true, title="Show Yesterdays OHLC?") sy2 = input(true, title="Show 2 days ago OHLC?") swt = input(false, title="Show This Weeks OHLC?") swy = input(true, title="Show Previous Weeks OHLC?") swy2 = input(true, title="Show 2 Weeks ago OHLC?") swy3 = input(true, title="Show 3 Weeks ago OHLC?") smh = input(false, title="Show Monthly OHLC?") spmh = input(false, title="Show Previous Months OHLC?") spmh2 = input(false, title="Show 2 Months ago OHLC?") //Daily ph = security(tickerid, 'D', high) pdh = security(tickerid, 'D', high[1]) pdh2 = security(tickerid, 'D', high[2]) pl = security(tickerid, 'D', low) pdl = security(tickerid, 'D', low[1]) pdl2 = security(tickerid, 'D', low[2]) //Weekly wph = security(tickerid, 'W', high) wpdh = security(tickerid, 'W', high[1]) wpdh2 = security(tickerid, 'W', high[2]) wpdh3 = security(tickerid, 'W', high[3]) wpl = security(tickerid, 'W', low) wpdl = security(tickerid, 'W', low[1]) wpdl2 = security(tickerid, 'W', low[2]) wpdl3 = security(tickerid, 'W', low[3]) //Monthly mph = security(tickerid, 'M', high) mpdh = security(tickerid, 'M', high[1]) mpdh2 = security(tickerid, 'M', high[2]) mpl = security(tickerid, 'M', low) mpdl = security(tickerid, 'M', low[1]) mpdl2 = security(tickerid, 'M', low[2]) //Daily Plots offs_daily = 0 plot(st and ph ? ph : na, title="Daily High", style=circles, linewidth=2, color=lime) plot(sy and pdh ? pdh : na, title="Previous Daily High", style=cross, linewidth=2, color=lime) plot(sy2 and pdh2 ? pdh2 : na, title="Previous 2 Daily High", style=cross, linewidth=2, color=lime) plot(st and pl ? pl : na, title="Daily Low", style=circles, linewidth=2, color=red) plot(sy and pdl ? pdl : na, title="Previous Daily Low", style=cross, linewidth=2, color=red) plot(sy2 and pdl2 ? pdl2 : na, title="Previous 2 Daily Low", style=cross, linewidth=2, color=red) //Weekly Plots plot(swt and wph ? wph : na, title="Weekly High", style=circles, linewidth=3, color=green) plot(swy and wpdh ? wpdh : na, title="Previous Weeks High", style=cross, linewidth=3, color=green) plot(swy2 and wpdh2 ? wpdh2 : na, title="Previous 2 Weeks High", style=cross, linewidth=3, color=green) plot(swy3 and wpdh3 ? wpdh3 : na, title="Previous 3 Weeks High", style=cross, linewidth=3, color=green) plot(swt and wpl ? wpl : na, title="Weekly Low", style=circles, linewidth=3, color=red) plot(swy and wpdl ? wpdl : na, title="Previous Weeks Low", style=cross, linewidth=3, color=red) plot(swy2 and wpdl2 ? wpdl2 : na, title="Previous 2 Weeks Low", style=cross, linewidth=3, color=red) plot(swy3 and wpdl3 ? wpdl3 : na, title="Previous 3 Weeks Low", style=cross, linewidth=3, color=red) //Monthly Plots plot(smh and mph ? mph : na, title="Monthly High", style=circles, linewidth=4, color=green) plot(spmh and mpdh ? mpdh : na, title="Previous Monthly High", style=cross, linewidth=4, color=green) plot(spmh2 and mpdh2 ? mpdh2 : na, title="Previous 2 Monthly High", style=cross, linewidth=4, color=green) plot(smh and mpl ? mpl : na, title="Monthly Low", style=circles, linewidth=4, color=red) plot(spmh and mpdl ? mpdl : na, title="Previous Months Low", style=cross, linewidth=4, color=red) plot(spmh2 and mpdl2 ? mpdl2 : na, title="Previous 2 Months Low", style=cross, linewidth=4, color=red) //Round Levels roundLevel50 = input(500, 'Round Level 1, pips') roundLevel100 = input(1000, 'Round Level 2, pips') deviation = input(1000, 'Max distance, pips', minval=0) rDelimeter = 1/syminfo.mintick intRoundLevel = close * rDelimeter intRemainder = intRoundLevel % roundLevel50 toRound = (intRemainder >= roundLevel50/2) ? roundLevel50 : 0 roundLevel = (intRoundLevel - intRemainder + toRound) / rDelimeter plot((abs(roundLevel - close) * rDelimeter < deviation) ? roundLevel : na, title='Round Level 1', color=black, style=circles, transp=0, linewidth=1, trackprice=true) intRemainder2 = intRoundLevel % roundLevel100 toRound2 = (intRemainder2 >= roundLevel100/2) ? roundLevel100 : 0 roundLevel2 = (intRoundLevel - intRemainder2 + toRound2) / rDelimeter plot((abs(roundLevel2 - close) * rDelimeter < deviation) ? roundLevel2 : na, title='Round Level 2', color=black, style=circles, transp=0, linewidth=1, trackprice=true)