- 精华
- 0
- 在线时间
- 3840 小时
- UID
- 20842
- 积分
- 931
- 帖子
- 382
- 阅读权限
- 255
- 注册时间
- 2010-12-3
- 最后登录
- 2022-2-15
- 精华
- 0
- UID
- 20842
- 积分
- 931
- 帖子
- 382
- 主题
- 2
- 阅读权限
- 255
- 注册时间
- 2010-12-3
- 最后登录
- 2022-2-15
|
在V4中写了一段代码,供参考。- Params
- Numeric Length1(10);
- Numeric Length2(20);
- Vars
- NumericSeries MA1;
- NumericSeries MA2;
- BoolSeries condBuy;
- BoolSeries condSell;
- Numeric BuySignalDays;
- Numeric SellSignaldays;
- Begin
- MA1 = AverageFC(Close,Length1);
- MA2 = AverageFC(Close,Length2);
- PlotNumeric("MA1",MA1);
- PlotNumeric("MA2",MA2);
-
- condBuy = CrossOver(MA1,MA2);
- condSell = CrossUnder(MA1,MA2);
- Commentary("condBuy="+iifstring(condBuy,"true","false"));
- Commentary("condSell="+iifstring(condSell,"true","false"));
-
- BuySignaldays = NthCon(condBuy,1);
- SellSignalDays = NthCon(condSell,1);
- Commentary("BuySignaldays="+Text(BuySignalDays));
- Commentary("SellSignaldays="+Text(SellSignalDays));
- End
复制代码 |
|