Как перенести этот код из Pinescript версии 1.0 в версию 3.0 - PullRequest
0 голосов
/ 19 апреля 2019

Мне нужно перенести этот код из pinescript 1.0 в 3.0

Это выдает мне эти ошибки при попытке его использовать "ОШИБКА: НЕИЗВЕСТНЫЙ ИДЕНТИФИКАТОР"

Хотите знать, как я могу преобразоватькод в pinescript 3.0

//@version=3
study("MTF candles", shorttitle="MTF candles", overlay=true)

res = input("60", type=resolution)

intv=security(tickerid, res, isintraday?interval:interval*1440)
o = security(tickerid, res, open, barmerge.gaps_off, barmerge.lookahead_on)
c = security(tickerid, res, close, barmerge.gaps_off, barmerge.lookahead_on)
h = security(tickerid, res, high, barmerge.gaps_off, barmerge.lookahead_on)
l = security(tickerid, res, low, barmerge.gaps_off, barmerge.lookahead_on)

min_of_day = (hour*60)+minute
midpoint=floor(intv/2)
wickwidth=input(1.0, title="Wick width in bars")*interval/2
step= input(true, title="Gray Borders with square edges of candles")
topsbots= input(true, title="Color top/bottom edge of candles")
pointyline= input(false, title="Colored Borders with non-square edges of candles")

wicktime= ((min_of_day % intv > midpoint-wickwidth) and (min_of_day % intv  <= midpoint+wickwidth)) ?true:false

col = c >= o ? lime : red

// why so many options... see below
plot(not pointyline?na:wicktime?o>c?h:l:o, color=col, title="Open", style=line, transp=40, title="pointyline open")
plot(not pointyline?na:wicktime?o<=c?h:l:c, color=col, title="Close", style=line, transp=40, title="pointyline close")
plot(not step?na:wicktime?o>c?h:l:o, color=gray, title="Open", style=stepline, transp=20, title="stepline open")
plot(not step?na:wicktime?o<=c?h:l:c, color=gray, title="Close", style=stepline, transp=20, title="stepline close")
plot(not topsbots?na:wicktime?o>c?h:l:o, color=col, title="Open", style=circles, transp=80)
plot(not topsbots?na:wicktime?o<=c?h:l:c, color=col, title="Close", style=circles, transp=80)

// These are the lines that should work, but...
// plot(foo,style=stepline, color=col) is not properly implemented by pinescript -- The color does not update
// and fill() does not properly fill steplines -- It fill them line regular lines.
// Both bugs have been reported.
// That is why the transparency is set to 100
po = plot(wicktime?o>c?h:l:o, color=col, title="Open", style=stepline, transp=100, title="hidden open", editable=false)
pc = plot(wicktime?o<=c?h:l:c, color=col, title="Close", style=stepline, transp=100, title="hidden close", editable=false)
// wick tips
plot(wicktime and h>c?h:na, color=col, title="High", style=circles, transp=60)
plot(wicktime and l<c?l:na, color=col, title="Low", style=circles, transp=60)

fill(po, pc, col)
...