ATRSLTP
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © samoke

//@version=4
//study("Benim Komutum")
study(title="ATRSLTP", shorttitle="ATRSLTP",  overlay=true)

lengthATR = input(title="Length", defval=14, minval=1)
multiplierATR = input(1.5, minval=1, title="multiplierATR")
multiplierATR2 = input(2.5, minval=1, title="multiplierATR2")
sourceATR = input(close, title="sourceATR") 
smoothingATR = input(title="Smoothing", defval="RMA", options=["RMA", "SMA", "EMA", "WMA"])
ma_function(source, lengthATR) =>
	if smoothingATR == "RMA"
		rma(source, lengthATR)
	else
		if smoothingATR == "SMA"
			sma(source, lengthATR)
		else
			if smoothingATR == "EMA"
				ema(source, lengthATR)
			else
				wma(source, lengthATR)



plot(rma(sourceATR, 1)-multiplierATR*ma_function(tr(true), lengthATR),"ATR",color=color.red,trackprice=true)
plot(rma(sourceATR, 1)-multiplierATR2*ma_function(tr(true), lengthATR),"ATR2",color=color.red,trackprice=true)
plot(rma(sourceATR, 1)+5*ma_function(tr(true), lengthATR),"TargetATR",color=color.green,trackprice=true)







