Dontpanic_es

PriceChannel for D1 v1.0

//@version=2
strategy(title = "PriceChannel for D1 v1.0", shorttitle = "PriceChannel D1", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100.0, pyramiding = 0)

//Settings
needlong = input(true, "long")
needshort = input(true, "short")
slowlen = input(30, defval = 30, minval = 2, maxval = 200, title = "PriceChannel Period")
pcbars = input(1, defval = 1, minval = 1, maxval = 20, title = "PriceChannel Bars")
usecol = input(true, "Use color-filter")
usebod = input(true, "Use body-filter")
needbg = input(false, defval = false, title = "Need trend Background?")
fromyear = input(1900, defval = 1900, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")
src = close

//PriceChannel
lasthigh = highest(src, slowlen)
lastlow = lowest(src, slowlen)
center = (lasthigh + lastlow) / 2

//Trend
ub = low > center ? 1 : 0
db = high < center ? 1 : 0
trend = sma(ub, pcbars) == 1 ? 1 : sma(db, pcbars) == 1 ? -1 : trend

//Body
body = abs(close - open)
abody = sma(body, 10)

//Signals
up = trend == 1 and (close < open or usecol == false) and (body > abody / 5 or usebod == false)
dn = trend == -1 and (close > open or usecol == false) and (body > abody / 5 or usebod == false)

//alert (не работает не выводится в окно напоминалок)
alertcondition(up, title="LG", message="в Лонг")
alertcondition(dn, title="SH", message="В шорт")

//Lines
plot(center, color = blue, linewidth = 3, transp = 0, title = "PriceChannel Center")

//Background
col = needbg == false ? na : trend == 1 ? lime : red
bgcolor(col, transp = 80)


//Trading
if up
strategy.entry("Long", strategy.long, needlong == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))

if dn
strategy.entry("Short", strategy.short, needshort == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))

if time > timestamp(toyear, tomonth, today, 23, 59)
strategy.close_all()
招待専用スクリプト

このスクリプトへのアクセスは作者が許可したユーザーに制限されており、通常はお支払いが必要です。お気に入りに追加することはできますが、許可を申請して作者が許可した後でなければ使用することはできません。 詳細については Dontpanic_es にお問い合わせいただくか、以下の作者の指示に従ってください。

TradingViewは、スクリプトの作者を100%信頼して、スクリプトの動作を理解しているといった場合でない限りは、代金を支払って利用される事をお勧めしません。多くのケースでは、コミュニティスクリプトでオープンソースの優れた代替スクリプトを無料で見つける事ができます。

免責事項

これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。

チャートでこのスクリプトを利用したいですか?

注: アクセス権をリクエストされる前にご覧ください