金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 3073|回复: 2

一个帖子的代码问题。

[复制链接]

95

主题

244

帖子

254

积分

Rank: 4

等级: 专业版

注册:
2021-5-20
曾用名:
发表于 2022-4-23 21:48 | 显示全部楼层 |阅读模式
runmode:0;
variable:cc=0;
ma5:=ma(c,5);
ma20:=ma(c,20);
entertime:=time>100000 and time<144500;

if holding>0 and cc<=0 then sell(1,1,limitr,o);               //注释变化
if holding<0 and cc>=0 then sellshort(1,1,limitr,o);        //注释变化
if holding=0 and cc>0 then buy(1,1,limitr,o);                  //注释变化
if holding=0 and cc<0 then buyshort(1,1,limitr,o);          //注释变化

if cc>0 and ma5<ma20 then cc:=0;
if cc<0 and ma5>ma20 then cc:=0;
if cc=0 and ma5>ma20 and entertime then cc:=1;
if cc=0 and ma5<ma20 and entertime then cc:=-1;
if time>=150000 then begin   cc:=0;

我很奇怪的是比如“if holding=0 and cc>0”,这个CC>0是绝对不成立的啊,定义全局变量的时候CC就是等于0,现在突然CC>0的条件出来,这个条件是永远不会触发的,不知道我这么理解对不对,请解释一下。

回复

使用道具 举报

21

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
FireScript
发表于 2022-4-23 22:05 | 显示全部楼层
你这后面有赋值语句的啊。

if cc=0 and ma5>ma20 and entertime then cc:=1;

满足时候会赋值的。
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

95

主题

244

帖子

254

积分

Rank: 4

等级: 专业版

注册:
2021-5-20
曾用名:
 楼主| 发表于 2022-4-27 20:51 | 显示全部楼层
技术009 发表于 2022-4-23 22:05
你这后面有赋值语句的啊。

if cc=0 and ma5>ma20 and entertime then cc:=1;

好像是的,有个逻辑在里面
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 微信登录

本版积分规则

手机版|小黑屋|上海金之塔信息技术有限公司 ( 沪ICP备13035422号 )

GMT+8, 2025-7-14 04:04 , Processed in 0.090842 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表