OPEN-SOURCE SCRIPT

Previous Day O H L C Calculation By Md

98
//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)

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.