JPY PPL
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ploo31 
//@version=4
//this indcator is applicable for JPY Pairs
//syminfo : forex - JPY pairs
//  Psychological Key Levels for JPY pairs. 

study("PPL", shorttitle="PPL", overlay=true)


tick = tickerid(syminfo.prefix, syminfo.ticker, session.regular, adjustment.splits)
sintra = input(true, title="Show PPL")
col = input(title="Color", type=input.color, defval=color.orange)
sty = input(title="Line", type=input.string,  options=["Solid", "Dotted", "Dashed"], defval="Solid")
lineWidth = input(1, title="Line width", type=input.integer)
nbintra = input(3, title="Number of Levels", type=input.integer)


//style function
style(z) => z=="Dotted"?line.style_dotted:z=="Dashed"?line.style_dashed:line.style_solid



//i_srLnColor      = input(#4dd0e141, ""                                         , inline = "SR", group = group_support_and_resistance)
//i_srLnWidth      = input(3        , ""                                         , inline = "SR", group = group_support_and_resistance)
//i_srLnStyle      = input("Solid"  , "", options = ["Dashed", "Dotted", "Solid"], inline = "SR", group = group_support_and_resistance)

//tracage des instit 100 pips 
//ne seront pas affiché sur les daily et au dela (A CODER)
step = syminfo.mintick*1000



if barstate.islast and syminfo.type == 'forex' and sintra
    //label.new(bar_index, low, text=syminfo.type, yloc=yloc.abovebar)
    for counter = 0 to nbintra - 1
        //20
        stepUp = ceil(close / step) * step + (counter * step)
        stepUp20 = stepUp + 0.2 * step
        line.new(bar_index, stepUp20, bar_index - 1, stepUp20, xloc=xloc.bar_index, extend=extend.both, color=col, width=lineWidth, style=style(sty))
        stepUp50 = stepUp + 0.5 * step
        line.new(bar_index, stepUp50, bar_index - 1, stepUp50, xloc=xloc.bar_index, extend=extend.both, color=col, width=lineWidth, style=style(sty))
        stepUp80 = stepUp + 0.8 * step
        line.new(bar_index, stepUp80, bar_index - 1, stepUp80, xloc=xloc.bar_index, extend=extend.both, color=col, width=lineWidth, style=style(sty))
        stepUp100 = stepUp + 1.0 * step
        line.new(bar_index, stepUp100, bar_index - 1, stepUp100, xloc=xloc.bar_index, extend=extend.both, color=col, width=lineWidth, style=style(sty))
       
        stepDown = ceil(close / step) * step - (counter * step)
        stepDown00 = stepDown + 0.0 * step
        line.new(bar_index, stepDown00, bar_index - 1, stepDown00, xloc=xloc.bar_index, extend=extend.both, color=col, width=lineWidth, style=style(sty))        
        stepDown20 = stepDown + 0.2 * step
        line.new(bar_index, stepDown20, bar_index - 1, stepDown20, xloc=xloc.bar_index, extend=extend.both, color=col, width=lineWidth, style=style(sty))
        stepDown50 = stepDown + 0.5 * step
        line.new(bar_index, stepDown50, bar_index - 1, stepDown50, xloc=xloc.bar_index, extend=extend.both, color=col, width=lineWidth, style=style(sty))
        stepDown80 = stepDown + 0.8 * step
        line.new(bar_index, stepDown80, bar_index - 1, stepDown80, xloc=xloc.bar_index, extend=extend.both, color=col, width=lineWidth, style=style(sty))

//label.delete(l[1]) 
//price_now = security(tick, "D", close)