Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共10 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]

1楼
scarecrow 发表于:2016/10/23 23:50:40
想请教一下大家,能不能引用上一个k线的计算值,我使用了ref来回溯上一根k线的计算值,但是显示语法错误,比如我下面的例子:

variable:biao_0=0;

ma1:ma(CLOSE,5);
ma2:ma(close,10);

if ma1>ma2 and biao<>1 then begin
biao:=1;
hai:=HIGH;
goto abc;
end


if ma1>ma2 and biao=1 then begin 
hai:=(ref(hai,1) + 10*MINDIFF);//------提示ref 函数在逐k线模式下不能直接在if控制语句之内引用(我是想满足条件后,把利用上一根k线的“hai”值来计算,得                                                         出结果后,再赋予该k线的“hai”值)
end

if ma1=<ma2 then begin
biao:=0;
end

abc@ exit;
2楼
scarecrow 发表于:2016/10/23 23:58:21
不好意思啊,上面的有点小问题,以下才是我请教的问题
想请教一下大家,能不能引用上一个k线的计算值,我使用了ref来回溯上一根k线的计算值,但是显示语法错误,比如我下面的例子:
variable:biao_0=0;//平

ma1:ma(CLOSE,5);
ma2:ma(close,10);

if ma1>ma2 and biao_0<>1 then begin
biao:=1;
hai:=HIGH;
goto abc;
end


if ma1>ma2 and biao=1 then begin 
hai:=(ref(hai,1) + 10*MINDIFF);//------提示ref 函数在逐k线模式下不能直接在if控制语句之内引用(我是想满足条件后,把利用上一根k线的“hai”值来计算,得出结果后,再赋予该k线的“hai”值)
end

if ma1<=ma2 then begin
biao:=0;
end

abc@ exit

3楼
jinzhe 发表于:2016/10/24 9:16:44
错误的那段改为:
h1:=ref(hai,1);
if ma1>ma2 and biao=1 then begin 
hai:=(h1 + 10*MINDIFF);//------提示ref 函数在逐k线模式下不能直接在if控制语句之内引用(我是想满足条件后,把利用上一根k线的“hai”值来计算,得出结果后,再赋予该k线的“hai”值)
end
4楼
scarecrow 发表于:2016/10/24 11:50:56
要是这样修改的话,就不符合我所需要的设计条件喔,我设计条件是,当if满足某一条件,然后回溯前一个值hai,然后给予这个hai值加10*MINDIFF赋予新的hai
5楼
jinzhe 发表于:2016/10/24 13:10:38
一个意思
6楼
scarecrow 发表于:2016/10/24 15:51:58
variable:biao_0=0;//平

ma1:ma(CLOSE,5);
ma2:ma(close,10);

if ma1>ma2 and biao_0<>1 then begin
biao:=1;
hai:HIGH;//划线显示在图表
goto abc;
end


h1:=ref(hai,1);
if ma1>ma2 and biao=1 then begin 
hai:(h1 + 10*MINDIFF);//划线显示在图表上
end

if ma1<=ma2 then begin
biao:=0;
end

abc@ exit

你好啊,还有一个问题是,我想把每个阶段的“hai”的划线输出到图表上,但是我这样写会显示:编译错误:变量名“hai”重复。
其实我的目的就是把满足每个阶段的“hai”的划线输出到图表上
7楼
jinzhe 发表于:2016/10/24 15:54:50
variable:biao_0=0;//平

ma1:ma(CLOSE,5);
ma2:ma(close,10);

if ma1>ma2 and biao_0<>1 then begin
biao:=1;
hai1:HIGH;//划线显示在图表
goto abc;
end


h1:=ref(hai,1);
if ma1>ma2 and biao=1 then begin 
hai2:(h1 + 10*MINDIFF);//划线显示在图表上
end

if ma1<=ma2 then begin
biao:=0;
end

abc@ exit
8楼
jinzhe 发表于:2016/10/24 15:55:01
做个编号就行了
9楼
scarecrow 发表于:2016/10/24 16:08:29
编号,怎么编号,具体的方法可以介绍一下吗?
是编个小图标吗
10楼
jinzhe 发表于:2016/10/24 16:40:32
看我代码里面 hai1,hai2就是编号
共10 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.03906 s, 3 queries.