vbs如何向公式系统传递数组 [金字塔]
- 咨询内容:
vbs中有如下类型数据,如何向金字塔公式系统传递?
dc := 1000;
VARIABLE:openPrice2[dc]=0;
<%vOpenPrice2 = ffl.vardata("openPrice2")
'对vOpenPrice2数组中每个元素进行计算处理并赋值'......
ffl.vardata("openPrice2") = vOpenPrice2
%>
请问以上写法正确吗?
- 金字塔客服:
测试一下不就知道了,用MSGBOX打印看看传递过去的数据是否是数组
- 用户回复:
openPrice := open;
highPrice := high;
lowPrice := low;
closePrice := close;
dc := 1000;
VARIABLE:openPrice2[dc]=0,highPrice2[dc]=0,lowPrice2[dc]=0,closePrice2[dc]=0;
<%
vOpenPrice = ffl.vardata("openPrice")
vHighPrice = ffl.vardata("highPrice")
vLowPrice = ffl.vardata("lowPrice")
vClosePrice = ffl.vardata("closePrice")
last = ubound(vOpenPrice)
vo = 0
vh = 0
vl = 0
vc = 0
i = 1
j = 0
dim openPriceArray(1000)
dim highPriceArray(1000)
dim lowPriceArray(1000)
dim closePriceArray(1000)
do while(i <= last)
if ((vOpenPrice(i) > vClosePrice(i)) and (vOpenPrice(i-1) < vClosePrice(i-1))) then '前面一根是阳线,后面连续阴线
vo = vOpenPrice(i)
vh = vHighPrice(i)
vl = vLowPrice(i)
vc = vClosePrice(i)
i = i + 1
do until ((vOpenPrice(i+1) < vClosePrice(i+1)) or (i > 1000)) '连续阴线直到遇到阳线为止
vc = vClosePrice(i)
if (vHighPrice(i) > vh) then
vh = vHighPrice(i)
end if
if (vLowPrice(i) < vl) then
vl = vLowPrice(i)
end if
i = i + 1
loop
openPriceArray(j) = vo
highPriceArray(j) = vh
lowPriceArray(j) = vl
closePriceArray(j) = vc
j = j + 1
end if
if ((vOpenPrice(i) < vClosePrice(i)) and (vOpenPrice(i-1) > vClosePrice(i-1))) then '前面一根是阴线,后面连续阳线
vo = vOpenPrice(i)
vh = vHighPrice(i)
vl = vLowPrice(i)
vc = vClosePrice(i)
i = i + 1
do until ((vOpenPrice(i+1) > vClosePrice(i+1)) or (i > 1000)) '连续阳线直到遇到阴线为止
vc = vClosePrice(i)
if (vHighPrice(i) > vh) then
vh = vHighPrice(i)
end if
if (vLowPrice(i) < vl) then
vl = vLowPrice(i)
end if
i = i + 1
loop
openPriceArray(j) = vo
highPriceArray(j) = vh
lowPriceArray(j) = vl
closePriceArray(j) = vc
j = j + 1
end if
loop
ffl.vardata("openPrice2") = openPriceArray
ffl.vardata("highPrice2") = highPriceArray
ffl.vardata("lowPrice2") = lowPriceArray
ffl.vardata("closePrice2") = closePriceArray
%>
//KLINE(openPrice,highPrice,lowPrice,closePrice,1);
KLINE(openPrice2,highPrice2,lowPrice2,closePrice2,1);采用这种方式,编译通不过,提示“未定义的变量:OPENPRICE2”!请问问题出在哪儿了?
- 网友回复:
你的数组用法是有问题的,因为定义的数组与序列变量还是有些区别
openPrice2:=c;
highPrice2:=c;
lowPrice2:=c;
closePrice2:=c;你这样定义这4个变量为序列变量酒可以解决了
如果以上指标公式不适用于您常用的行情软件
或者您想改编成选股公式,以便快速选出某种形态个股的话,
- 上一篇:Demoaddin 为什么生成是adi文件
- 下一篇:没有了!
相关文章
-
没有相关内容