DEV0EuH7
DEV0EuH7
// Entry conditions
callBuy = ta.crossover(closeBN, resistance) and emaShort > emaLong and rsi > 50 and
macdLine > signalLine
putBuy = ta.crossunder(closeBN, support) and emaShort < emaLong and rsi < 50 and
macdLine < signalLine
if callBuy
isBuy := true
isSell := false
if putBuy
isBuy := false
isSell := true
// Signals
plotshape(callBuy, title = 'Call Buy Signal', location = location.belowbar, color =
color.green, style = shape.labelup, text = 'CALL')
plotshape(putBuy, title = 'Put Buy Signal', location = location.abovebar, color =
color.red, style = shape.labeldown, text = 'PUT')
// Alerts
alertcondition(callBuy, title = 'Call Buy Alert', message = 'Buy Call Option')
alertcondition(putBuy, title = 'Put Buy Alert', message = 'Buy Put Option')
///////////
///////////
// Signal conditions
longCond = callBuy
shortCond = putBuy
// Add ATM option labels with premiums, stoploss, targets, and signal time
if (longCond)
label.new(bar_index, hl2*0.98 + 40,
"ATM " + str.tostring(atmStrike) + " CE: " + callPremiumFormatted +
"\nSL: " + callStoplossFormatted +
"\nT1: " + callTarget1Formatted + "\nT2: " + callTarget2Formatted +
"\nT3: " + callTarget3Formatted +
"\nT4: " + callTarget4Formatted + "\nT5: " + callTarget5Formatted +
"\nTime: " + signalTimeFormatted,
style=label.style_label_up, color=color.new(color.green, 0),
textcolor=color.white, textalign=text.align_left)
if (shortCond)
label.new(bar_index, hl2*1.02 - 40,
"ATM " + str.tostring(atmStrike) + " PE: " + putPremiumFormatted + "\
nSL: " + putStoplossFormatted +
"\nT1: " + putTarget1Formatted + "\nT2: " + putTarget2Formatted + "\
nT3: " + putTarget3Formatted +
"\nT4: " + putTarget4Formatted + "\nT5: " + putTarget5Formatted + "\
nTime: " + signalTimeFormatted,
style=label.style_label_down, color=color.new(color.red, 0),
textcolor=color.white, textalign=text.align_left)