Reputation: 15
Below is the code i am using for genearte candle stick chart for straddle options for nifty. But when i plot same chart on tradingview the high low values are different than they should be. Can someone please help me resolve the issue to get correct values? I tried using barmerge.gaps and lookahead but it did not make any difference. Any help is appreciated.
//@version=5
indicator('Straddle', shorttitle='Options_Straddle', timeframe='', overlay = false)
OptionsChart1 = input.symbol('', title='OptionsChart1 Symbol')
OptionsChart2 = input.symbol('', title='OptionsChart2 Symbol')
_developingLineStyle = 'Combined'
var o = 0.00
var h = 0.00
var l = 0.00
var c = 0.00
[oo, hh, ll, cc] = request.security(OptionsChart1, timeframe.period, [open, high, low, close], barmerge.gaps_on)
[ooo , hhh, lll , ccc]= request.security(OptionsChart2, timeframe.period, [open, high, low, close], barmerge.gaps_on)
if _developingLineStyle == 'Combined'
o := oo + ooo
h := hh + hhh
l := ll + lll
c := cc + ccc
// if _developingLineStyle == 'Difference'
// o := oo - ooo
// h := hh - hhh
// l := ll - lll
// c := cc - ccc
// if _developingLineStyle == 'Ratio'
// o := oo / ooo
// h := hh / hhh
// l := ll / lll
// c := cc / ccc
ourWickColor = c > c[1] ? color.green : color.red
plotcandle(o, h , l, c, title='OptionsStraddle', color=ourWickColor, force_overlay = false)**strong text**
Upvotes: 0
Views: 73