Pine脚本最小公倍数(LCM)
Pine script the least common multiple (LCM)
我正在寻找 pine 脚本 lcm。
各位高手,可以帮忙吗?我无法成功。这对你来说应该很简单。请帮助我
//@version=5
indicator(title='1', overlay=false, precision=2, timeframe='')
x = input(15)
y = input(30)
z =math.max (x,y)
e2=while ((z % x == 0) and (z % y == 0))
lcm:= z
break
z += 1
plot(lcm, color=color.new(color.black, 0))
您的 while 条件应该是无限 while 循环内的 if 检查。
这样做:
//@version=5
indicator(title='1', overlay=false, precision=2, timeframe='')
x = input(15)
y = input(30)
z =math.max (x,y)
lcm = 0
while (1)
if ((z % x == 0) and (z % y == 0))
lcm := z
break
z += 1
plot(lcm, color=color.new(color.black, 0))
我正在寻找 pine 脚本 lcm。
各位高手,可以帮忙吗?我无法成功。这对你来说应该很简单。请帮助我
//@version=5
indicator(title='1', overlay=false, precision=2, timeframe='')
x = input(15)
y = input(30)
z =math.max (x,y)
e2=while ((z % x == 0) and (z % y == 0))
lcm:= z
break
z += 1
plot(lcm, color=color.new(color.black, 0))
您的 while 条件应该是无限 while 循环内的 if 检查。
这样做:
//@version=5
indicator(title='1', overlay=false, precision=2, timeframe='')
x = input(15)
y = input(30)
z =math.max (x,y)
lcm = 0
while (1)
if ((z % x == 0) and (z % y == 0))
lcm := z
break
z += 1
plot(lcm, color=color.new(color.black, 0))