below is code:
Code: Select all
getPivotResolution() =>
endBarIndex = 0
resolution = 'D'
if pivot_time_frame == AUTO
resolution := 'D'
if timeframe.isminutes and timeframe.multiplier == 5
endBarIndex := 74
else if timeframe.isminutes and timeframe.multiplier == 3
endBarIndex := 124
[resolution,endBarIndex]
[resolution,endBarIndex]= getPivotResolution()
//finding high,low,close of the script
tH = request.security(syminfo.tickerid, resolution, high, barmerge.gaps_off, barmerge.lookahead_on)
tC = request.security(syminfo.tickerid, resolution, close, barmerge.gaps_off, barmerge.lookahead_on)
tL = request.security(syminfo.tickerid, resolution, low, barmerge.gaps_off, barmerge.lookahead_on)
tP = (tH + tL + tC) / 3
tBC = (tH + tL) / 2
tTC = tP - tBC + tP
//creating pivot line for the next day
if(barstate.islast)
line.new(bar_index+1,tP,bar_index+endBarIndex,tP, style=line.style_dotted,color = color.blue,width = 2)
line.new(bar_index+1,tBC,bar_index+endBarIndex,tBC, style=line.style_dotted,color = color.purple,width = 2)
line.new(bar_index+1,tTC,bar_index+endBarIndex,tTC, style=line.style_dotted,color = color.purple,width = 2)