0

需要将以下内容转换为 MQL4。原始脚本来自tradingview。该网站说要添加更多详细信息,所以我只是打字,因为我不知道该放什么。

//@version=4
strategy("EURGBP5M", overlay=true)

输入

// Inputs
vwap_show = input(true, title='Show VWAP')
vwap_buy_enabled = input(true, title='Enable VWAP Buy')
vwap_sell_enabled = input(true, title='Enable VWAP Sell')
vwapOffset = input(title='VWAP offset', defval=0)

start = security(syminfo.tickerid, "D", time)

newSession = iff(start > start[1], 1, 0)

vwapsum = 0.0
volumesum = 0.0
vwapsum := iff(newSession[1], hlc3*volume, 
vwapsum[1]+hlc3*volume)
volumesum := iff(newSession[1], volume, volumesum[1]+volume)
vwap_now = vwapsum/volumesum

plot(vwap_now, color = vwap_now >= highest(vwap_now, 4) ? 
color.blue : color.red, 
title='VWAP')

不同的线路

//LINES
myema = input(30, title="Center EMA", minval = 0)
lookback = input(100, title="Lookback", minval = 0)
multiplier = input(.5, title="Multiplier", minval = 0, step = 
0.01)
shortema = input(13, title="Short EMA", minval=1)
mode = input(title="Use Close?", type=input.bool, defval=true)
length = input(14, minval=1)
centerline = ema(close, myema)
// AutoEnvelope
myvar = mode == true ? abs(close - centerline) : max(abs(high - 
centerline), abs(low 
- centerline))
myvars = myvar * myvar
mymov = sqrt(sma(myvars, lookback))

newmax = max(mymov, max(mymov[1], max(mymov[2], max(mymov[3], 
max(mymov[4], mymov[5] 
) ) ) ) )
upper = centerline + (newmax * multiplier)
lower = centerline - (newmax * multiplier)
plot(upper, title = "upper", color = ema(close, 20) >= 
highest(ema(close, 20), 36) ? 
color.green : color.red, linewidth = 2)
plot(lower, title = "lower", color = ema(close, 20) >= 
highest(ema(close, 20), 36) ? 
color.green : color.red, linewidth = 2)

是否有已经构建的 rsi 指标?

//RSI
len = input(14, minval=1, title="Length")
src1 = input(close, "Source", type = input.source)
up = rma(max(change(src1), 0), len)
down = rma(-min(change(src1), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / 
down))

不同的时间范围

//TIME FRAME
t = time(timeframe.period, "0530-0930")
t1 = time(timeframe.period, "0750-1030")
t2 = time(timeframe.period, "0330-1100")

结束代码

4

0 回答 0