OPEN-SOURCE SCRIPT

Previous Day O H L C Calculation By Md

87
//version=6
indicator("Previous Day O H L C Calculation By Md", overlay=true)

// Check if the previous daily candle is green (bullish) or red (bearish)
previousCandleBullish = close[1] > open[1]
previousCandleBearish = close[1] < open[1]

// Calculate the difference for bullish candles: previous day's high minus previous day's open
bullishCalculation = high[1] - open[1]

// Calculate the difference for bearish candles: previous day's low minus previous day's close
bearishCalculation = low[1] - close[1]

// Show the result at the top of the current daily candle if the previous candle was bullish
if previousCandleBullish
label.new(bar_index, high, "Bullish Calc: " + str.tostring(bullishCalculation), color=color.green, textcolor=color.white, style=label.style_label_left, size=size.small)

// Show the result at the bottom of the current daily candle if the previous candle was bearish
if previousCandleBearish
label.new(bar_index, low, "Bearish Calc: " + str.tostring(bearishCalculation), color=color.red, textcolor=color.white, style=label.style_label_left, size=size.small)

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.