BNT5.0 Premium Indicator
BNT5.0 Premium Indicator
BNT5.0 Premium Indicator
indicator('BNT5.0', overlay=true)
var line futureCallLine = na
var line futurePutLine = na
var line futureTopPivotLine = na
var line futureCentralPivotLine = na
var line futureBottomPivotLine = na
dir = 1
dir := nz(dir[1], dir)
dir := dir == -1 and close > shortStopPrev ? 1 : dir == 1 and close <
longStopPrev ? -1 : dir
//CPR Calculations
centralPivot = (pivotTFHigh + pivotTFLow + pivotTFClose) / 3
tempBottomPivot = (pivotTFHigh + pivotTFLow) / 2
tempTopPivot = (centralPivot - tempBottomPivot) + centralPivot
//Strike Values
spreadValue = spreadMethod == "Auto" ? close >= 1000 ? 50.0 :
close >= 500 ? 10.0 :
close >= 100 ? 5.0 :
close >= 50 ? 2.5 :
close >= 20 ? 1 :
close < 20 ? 0.5 : 0
:
manSpreadValue
//Tomorrow's Strikes
calcDevCallValue = close < devTS1 ? devTopPivot : math.avg(devCentralPivot,
math.max(devPivotTFHigh, devTR1))
calcDevPutValue = close > devTR1 ? devBottomPivot : math.avg(devCentralPivot,
math.min(devPivotTFLow, devTS1))
devCallStrikeValue = spreadValueCalc(calcDevCallValue, spreadValue, 'Call')
devPutStrikeValue = spreadValueCalc(calcDevPutValue, spreadValue, 'Put')
//New Bar
is_newbar(res, sess) =>
t = time(res, sess)
na(t[1]) and not na(t) or t[1] < t
if na(futurePutLine)
futurePutLine := line.new(x1=bar_index, y1=devPutStrikeValue,
x2=bar_index + 5, y2=devPutStrikeValue, color=color.gray, extend=extend.right)
else
line.set_xy1(futurePutLine, bar_index, devPutStrikeValue)
line.set_xy2(futurePutLine, bar_index + 5, devPutStrikeValue)
if na(futureTopPivotLine)
futureTopPivotLine := line.new(x1=bar_index, y1=devTopPivot,
x2=bar_index + 5, y2=devTopPivot, color=color.black, extend=extend.right)
else
line.set_xy1(futureTopPivotLine, bar_index, devTopPivot)
line.set_xy2(futureTopPivotLine, bar_index + 5, devTopPivot)
if na(futureCentralPivotLine)
futureCentralPivotLine := line.new(x1=bar_index, y1=devCentralPivot,
x2=bar_index + 5, y2=devCentralPivot, color=color.purple, extend=extend.right)
else
line.set_xy1(futureCentralPivotLine, bar_index, devCentralPivot)
line.set_xy2(futureCentralPivotLine, bar_index + 5, devCentralPivot)
if na(futureBottomPivotLine)
futureBottomPivotLine := line.new(x1=bar_index, y1=devBottomPivot,
x2=bar_index + 5, y2=devBottomPivot, color=color.black, extend=extend.right)
else
line.set_xy1(futureBottomPivotLine, bar_index, devBottomPivot)
line.set_xy2(futureBottomPivotLine, bar_index + 5, devBottomPivot)
//Alerts
sendAlert = close < 6000
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
ShowSD1 = input.bool(false, 'Supply Demand Zone', group='Supply Demand 1',
inline='Supply Demand 1')
ShowSZ1 = input.bool(false, 'Support Zone', group='Supply Demand 1', inline='Supply
Demand 1')
ShowRZ1 = input.bool(false, 'Resistance Zone', group='Supply Demand 1',
inline='Supply Demand 1')
RSI1Length = input.int(7, minval=1, title='RSI 1 Length', group='Supply Demand 1')
RSI1OBOSIn = input.string(defval='70 / 30', title='OB / OS', options=['70 / 30',
'75 / 25', '80 / 20', '85 / 15', '90 / 10', '95 / 5'], group='Supply Demand 1')
NumberOfConfirmationBarsRSI1 = input.int(3, title='Confirmation Bars',
group='Supply Demand 1')
///////////////////////////////////////////////////////////////////////////////////
RSI1rsx = 0
if RSI1incrementer_both
RSI1rsx := nz(RSI1rsx[1], 0) + RSI1incrementer_both
else
RSI1rsx := 0
var float RSI1rxH = na
if RSI1rsx >= NumberOfConfirmationBarsRSI1
RSI1rxH := high
var float RSI1rxL = na
if RSI1rsx >= NumberOfConfirmationBarsRSI1
RSI1rxL := low
RSI1rH = fixnan(RSI1rxH)
RSI1rL = fixnan(RSI1rxL)
///////////////////////////////////////////////////////
RSI1rsu = 0
if RSI1incrementer_up
RSI1rsu := nz(RSI1rsu[1], 0) + RSI1incrementer_up
else
RSI1rsu := 0
RSI1rssH = if RSI1rsu >= NumberOfConfirmationBarsRSI1
RSI1x = high
RSI1rssL = if RSI1rsu >= NumberOfConfirmationBarsRSI1
RSI1y = low
RSI1ResistanceZoneHigh = fixnan(RSI1rssH)
RSI1ResistanceZoneLow = fixnan(RSI1rssL)
////////////////////////////////////////////////////////
RSI1rsd = 0
if RSI1incrementer_down
RSI1rsd := nz(RSI1rsd[1], 0) + RSI1incrementer_down
else
RSI1rsd := 0
RSI1rsrH = if RSI1rsd >= NumberOfConfirmationBarsRSI1
RSI1x = high
RSI1SupportZoneHigh = fixnan(RSI1rsrH)
RSI1SupportZoneLow = fixnan(RSI1rsrL)
////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
PriceInRSI1SDZone = close <= RSI1rH and close >= RSI1rL and RSI1rH == RSI1rH[1]
PriceEntersRSI1SDZone = PriceInRSI1SDZone and not PriceInRSI1SDZone[1]
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
//
RSI2rsx = 0
if RSI2incrementer_both
RSI2rsx := nz(RSI2rsx[1], 0) + RSI2incrementer_both
else
RSI2rsx := 0
RSI2rH = fixnan(RSI2rxH)
RSI2rL = fixnan(RSI2rxL)
///////////////////////////////////////////////////////
RSI2rsu = 0
if RSI2incrementer_up
RSI2rsu := nz(RSI2rsu[1], 0) + RSI2incrementer_up
else
RSI2rsu := 0