对crossover内建函数有几点疑问 [开拓者 TB]
- 咨询内容:
//------------------------------------------------------------------------
 // 简称: CrossOver
 // 名称: 求是否上穿
 // 类别: 用户函数
 // 类型: 内建函数
 // 输出: 布尔型
 //------------------------------------------------------------------------
 
 Params
 NumericSeries Price1(1);
 NumericSeries Price2(1);
 Vars
 Bool Con1(False);
 Bool PreCon(False);
 Numeric Counter(0);
 Begin
 If(Price1 > Price2)
 {
 Counter = 1;
 Con1 = Price1[1] == Price2[1];
 While (Con1 and Counter < CurrentBar) {
 Counter = Counter + 1;
 Con1 = Price1[Counter] == Price2[Counter];
 }
 PreCon = Price1[Counter] < Price2[Counter];
 Return PreCon;
 }Else
 {
 Return False;
 }
 End
 
 //------------------------------------------------------------------------
 // 编译版本 GS2010.12.08
 // 版权所有 TradeBlazer Software 2003-2010
 // 更改声明 TradeBlazer Software保留对TradeBlazer平
 // 台每一版本的TradeBlazer公式修改和重写的权利
 //------------------------------------------------------------------------
 红色con1的表达式或者数值是哪一个,红色Counter < CurrentBar,counter和currentbar能比较吗?这里的counter包含的数值是哪些呢?
 
 
 
 
 
 
 
 
 
-  TB技术人员:
con1在前面的语句里赋值了呀,Price1[1] == Price2[1],就是判断这两个价格是否相等,满足条件之后,继续向前回溯,[]中用counter计数
 
 counter为什么不能和currentbar比较呢?这里主要的意思是回溯的值不能超过当前currentbar的索引值,是为了保证回溯有效的的。counter用于回溯计数,在前面赋值了,最开始是1,然后满足条件的时候每次增加1.
- TB客服:
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 1145508240  进行 有偿 编写!(不贵!点击查看价格!)
                        
相关文章
- 
                        没有相关内容
                       

 
                     会员登录/注册
会员登录/注册