63 lines
1.4 KiB
Plaintext
63 lines
1.4 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center ATR StopLoss Indicator
|
|
// ---------------------------------------------
|
|
// saherelm implementation of above indicator ...
|
|
//
|
|
// Maintainer:
|
|
// ------------
|
|
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
|
//
|
|
//////////////////////////////////////////////////////
|
|
|
|
//
|
|
//@version=5
|
|
indicator(title="SaherElm ATR StopLoss Indicator", shorttitle = "XS_ATRSL_IND", overlay = true)
|
|
|
|
//
|
|
// START Inputs ....
|
|
//
|
|
source = input(low, title = "Source")
|
|
length = input.int(defval = 14, minval = 1, title = "Period")
|
|
multiplier = input.float(defval = 1.6, minval = 0.1, step = 0.1, title = "Multiplier")
|
|
//
|
|
// END Inputs ....
|
|
//
|
|
|
|
//
|
|
// START Functions ....
|
|
//
|
|
//
|
|
// END Functions ....
|
|
//
|
|
|
|
//
|
|
// START Calculations ....
|
|
//
|
|
longStopLoss = source - ta.atr(length) * multiplier
|
|
shortStopLoss = source + ta.atr(length) * multiplier
|
|
//
|
|
// END Calculations ....
|
|
//
|
|
|
|
//
|
|
// START Plots ....
|
|
//
|
|
plot(series = shortStopLoss, color = color.aqua, linewidth = 1, style = plot.style_stepline, title = "Short Stop Loss")
|
|
plot(series = longStopLoss, color = color.fuchsia, linewidth = 1, style = plot.style_stepline, title = "Long Stop Loss")
|
|
//
|
|
// END Plots ....
|
|
//
|
|
|
|
//
|
|
// START Alerts ...
|
|
//
|
|
// END Alerts ...
|
|
//
|
|
|
|
//////////////////////////////////////////////////////
|
|
// TODOS:
|
|
// -------
|
|
// - []
|
|
//////////////////////////////////////////////////////
|