Convert my tradingview indicator script into a MT4 EA or indicator

MQL4 전환

작업 종료됨

실행 시간 12 시간

명시

//@version=4
study("Custom", overlay = true)
//Var dec
length = 9
fractionalMult = input(title="Key Value", step=1, defval=1)

tr2() =>
max(high - low, max(abs(high - close[1]), abs(low - close[1])))

//Calc delta
calc1(in1, in2) =>
alpha = in2
sum = 0.0
sum := (in1 + (alpha - 1) * nz(sum[1])) / alpha

value1 = fractionalMult * calc1(tr2(), length)

sigShort = hl2 + value1
sigShortPrev = nz(sigShort[1], sigShort)
sigLong = hl2 - value1
sigLongPrev = nz(sigLong[1], sigLong)

sigLong := close[1] > sigLongPrev ? max(sigLong, sigLongPrev) : sigLong
sigShort := close[1] < sigShortPrev ? min(sigShort, sigShortPrev) : sigShort

dir = 1
dir := nz(dir[1], dir)
//Filter extreme moves
dir := dir == -1 and close > sigShortPrev ? 1 : dir == 1 and close < sigLongPrev ? -1 : dir

alertcondition( dir[1] == -1 and dir == 1 ? sigLong : na, "BUY", "BUY")
alertcondition(dir[1] == 1 and dir == -1 ? sigShort : na, "SELL", "SELL")

//plot
plotshape(dir == 1 and dir[1] == -1 ? sigLong : na, title="LONG", style=shape.labelup, location=location.belowbar, size=size.normal, text="LONG", textcolor = color.white, color=http://color.green)
plotshape(dir == -1 and dir[1] == 1 ? sigShort : na, title="SHORT", style=shape.labeldown, location=location.abovebar, size=size.normal, text="SHORT", textcolor = color.white, color=http://color.red)


응답함

1
개발자 1
등급
(851)
프로젝트
1464
72%
중재
122
29% / 48%
기한 초과
358
24%
작업중
게재됨: 3 기고글
2
개발자 2
등급
(337)
프로젝트
624
38%
중재
40
23% / 65%
기한 초과
93
15%
무료
게재됨: 4 기고글, 19 코드
3
개발자 3
등급
(590)
프로젝트
789
71%
중재
9
33% / 33%
기한 초과
22
3%
무료
게재됨: 8 코드
4
개발자 4
등급
(4)
프로젝트
4
0%
중재
5
0% / 80%
기한 초과
1
25%
무료
5
개발자 5
등급
(647)
프로젝트
1295
67%
중재
84
26% / 49%
기한 초과
338
26%
무료

프로젝트 정보

예산
30+ USD
기한
에서 1 일