Gorbie

USDCAD 4h Indicator

148 0 9
Strategy + Indicator

Make your personal Alert for the entry!
Remove from Favorite Scripts Add to Favorite Scripts
study(title="USDCAD 4h", shorttitle="uc4h", overlay=true)

fastl = security(tickerid, "240", sma(close, 8))
slowl = security(tickerid, "240", sma(close, 57))
tpl = input(title="Take profit", type=integer, defval=2080)
sll = input(title="Stop loss", type=integer, defval=1650)
fasts = security(tickerid, "240", sma(close, 40))
slows = security(tickerid, "240", sma(close, 102))
tps = input(title="Take profit", type=integer, defval=920)
sls = input(title="Stop loss", type=integer, defval=550)
c = 100000 //contract size

buy = cross(fastl,slowl) and fastl>slowl and close
sell = cross(fasts,slows) and fasts<slows and close
long = (buy*close? buy*close : na)
short = (sell*close? sell*close : na)

//Signal
plot(fastl, color=silver, trackprice=false, title="8", transp=100)
plot(slowl, color=gray, trackprice=false, title="57", transp=100)
plot(fasts, color=silver, trackprice=false, title="40", transp=100)
plot(slows, color=gray, trackprice=false, title="102", transp=100)

//Alert
plotshape(long, "Alert Buy", shape.triangleup, location.belowbar, black, offset=0, text="buy", size=size.auto)
plotshape(short, "Alert Sell", shape.triangledown, location.abovebar, black, offset=0, text="sell", size=size.auto)

//Entry
entrybuy = security(tickerid, "60", long)
plot(entrybuy, "Buy price", style=linebr, linewidth=3, color=blue, trackprice=false)
entrysell = security(tickerid, "60", short)
plot(entrysell, "Sell price", style=linebr, linewidth=3, color=red, trackprice=false)

//Long
tpbuy = long + tpl/c
tpbb = security(tickerid, "60", tpbuy)
plot(tpbb, "Long Take", style=linebr, linewidth=3, color=green, trackprice=false)
slbuy = long - sll/c
slbb = security(tickerid, "60", slbuy)
plot(slbb, "Long Stop", style=linebr, linewidth=3, color=fuchsia, trackprice=false)

//Short
tpsell = short - tps/c
tpss = security(tickerid, "60", tpsell)
plot(tpss, "Short Take", style=linebr, linewidth=3, color=green, trackprice=false)
slsell = short + sls/c
slss = security(tickerid, "60", slsell)
plot(slss, "Short Stop", style=linebr, linewidth=3, color=fuchsia, trackprice=false)
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out