Previous Candle Range 15'-5'
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © pioannis

//@version=5
indicator("Previous Candle Range 15'-5'", shorttitle = "Previous Candle Range 15'-5'", overlay=true)

Lot_factor = input(1.0, "A factor in : LOT = Risc/(pips * A)")
risc = input(1000, "Risc in $")

candlerange = high[1] - low[1]

//if open[1] > close[1]
//    candlerange := high[1] - close[1]
//else
//    candlerange := close[1] - low[1]

//patternLabelPosLow = low[1] - math.abs(ta.atr(30) * 0.6)
patternLabelPosLow = high[0] 
//patternLabelPosHigh = high[0] + math.abs(ta.atr(30) * 0.6)

//l1 = label.new(bar_index[0]+5, patternLabelPosHigh, text=str.tostring(candlerange), style=label.style_label_down, color = color.rgb(89, 91, 89), textcolor=color.white)
l2 = label.new(bar_index[0]+10, patternLabelPosLow, text=("Lot = " + str.tostring((risc/(candlerange*Lot_factor)), "#.#")), style=label.style_label_down, color = color.rgb(41, 40, 40), textcolor=color.white, size=size.large)

//label.delete(l1[1])
label.delete(l2[1])

