欢迎您光临博庭社区!

 找回密码
 立即注册
查看: 8174|回复: 29

数组怎么用? [复制链接]

Rank: 3Rank: 3

发表于 2013-3-13 12:57:37 |显示全部楼层
“ x 错误 行:7 列:16 数组大小格式错误,需用数字声明大小,置空则为序列”

声明提示出错,源码:

suzu:=50;
variable:     zl[suzu]=0,                        zc[suzu]=0;


如何修改?

使用道具 举报

Rank: 8Rank: 8

发表于 2013-3-13 13:25:51 |显示全部楼层
目前暂不支持变量数组。
这样就可以:
variable:     zl[50]=0;
1,Initial stop loss
2,Trailing stop loss(Moves up from initial stop to reduce risk,Protects us at break-even point)
3,Profit protection stop(Keeps winning trades from becoming losses,Locks in a portion of the open profit)
4,Profit maximizing exit(Attempts to exit without giving back profits)

使用道具 举报

Rank: 3Rank: 3

发表于 2013-3-18 14:24:01 |显示全部楼层
variable:        aa=1;
if h>h[1] then aa:=barpos;
bb:h[DataCount-aa];

这个要怎么改才能用?

使用道具 举报

Rank: 8Rank: 8

发表于 2013-3-18 14:33:11 |显示全部楼层
hifiu 发表于 2013-3-18 14:24
variable:        aa=1;
if h>h[1] then aa:=barpos;
bb:h[DataCount-aa];

#Run_By_Bar
variable:        aa=1;
if h>h[1] then aa:=barpos;
bb:h[DataCount-aa];

试试这样
1,Initial stop loss
2,Trailing stop loss(Moves up from initial stop to reduce risk,Protects us at break-even point)
3,Profit protection stop(Keeps winning trades from becoming losses,Locks in a portion of the open profit)
4,Profit maximizing exit(Attempts to exit without giving back profits)

使用道具 举报

Rank: 3Rank: 3

发表于 2013-3-18 14:42:21 |显示全部楼层
本帖最后由 hifiu 于 2013-3-18 14:46 编辑

谢谢!
但出来的不是想要的效果,记录最高值。。

之前在金字塔里公式是:
variable:        aa=1;
if h>h[barpos-1] then aa:=barpos;
bb:h[aa];

使用道具 举报

Rank: 8Rank: 8

发表于 2013-3-19 09:04:19 |显示全部楼层
hifiu 发表于 2013-3-18 14:42
谢谢!
但出来的不是想要的效果,记录最高值。。


我把你的公式放到金字塔里,有错啊

附件: 你需要登录才可以下载或查看附件。没有帐号?立即注册
1,Initial stop loss
2,Trailing stop loss(Moves up from initial stop to reduce risk,Protects us at break-even point)
3,Profit protection stop(Keeps winning trades from becoming losses,Locks in a portion of the open profit)
4,Profit maximizing exit(Attempts to exit without giving back profits)

使用道具 举报

Rank: 3Rank: 3

发表于 2013-3-19 13:42:42 |显示全部楼层
啊,不好意思,你在最上面加一句:
if barpos<2 then exit;

使用道具 举报

Rank: 8Rank: 8

发表于 2013-3-19 14:20:49 |显示全部楼层
hifiu 发表于 2013-3-19 13:42
啊,不好意思,你在最上面加一句:
if barpos


#Run_By_Bar

variable:
高点(0),BarPosK(0);

if h>h[1] then begin
  for i=BarPosk to barpos-1 do begin
    高点1[BarPos-i] = 高点;
  end
  barposk = BarPos;
  高点 = high;
end else begin
  if high > 高点 then 高点 = high;
end
高点1:高点;
1,Initial stop loss
2,Trailing stop loss(Moves up from initial stop to reduce risk,Protects us at break-even point)
3,Profit protection stop(Keeps winning trades from becoming losses,Locks in a portion of the open profit)
4,Profit maximizing exit(Attempts to exit without giving back profits)

使用道具 举报

Rank: 3Rank: 3

发表于 2013-3-19 15:36:05 |显示全部楼层
谢谢bt11,有没有简化的可能性?
上面那段代码,不但没有发挥逐k的优势,反而增加了非常多倍的计算量。

我只是想通过这个例子,了解如何把金字塔的模型,转移到金魔方。
这下真吓到我了。

使用道具 举报

Rank: 8Rank: 8

发表于 2013-3-20 08:51:56 |显示全部楼层
hifiu 发表于 2013-3-19 15:36
谢谢bt11,有没有简化的可能性?
上面那段代码,不但没有发挥逐k的优势,反而增加了非常多倍的计算量。

#Run_By_Bar
#Run_Every_Tick

variable: myHigh(0);

if barpos = 1 then myHigh = high;
if h>h[1] then myHigh=h;
//else myhigh=ref(myhigh,1);
else myhigh=myhigh[1];
bb:myHigh;
1,Initial stop loss
2,Trailing stop loss(Moves up from initial stop to reduce risk,Protects us at break-even point)
3,Profit protection stop(Keeps winning trades from becoming losses,Locks in a portion of the open profit)
4,Profit maximizing exit(Attempts to exit without giving back profits)

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

bottom

Archiver|http://www.patiosoft.com

GMT+8, 2017-12-11 08:24 , Processed in 0.046424 second(s), 10 queries .

花生网 Copyrigh©2012

和讯信息科技有限公司 ALL Rights Reserved 版权所有 复制必究

回顶部