欢迎您光临花生网社区!
| |

 找回密码
 立即注册
查看: 5553|回复: 13
打印 上一主题 下一主题

怎么写语句判断现在是几点几分? [复制链接]



Rank: 3Rank: 3

跳转到指定楼层
1#
发表于 2013-5-7 13:12:12 |只看该作者 |倒序浏览 | [分享到 腾讯微博 新浪微博]
比如我有个策略只有在14:35分开始执行判断,一直到收盘

使用道具 举报



Rank: 3Rank: 3

2#
发表于 2013-5-7 13:12:58 |只看该作者 | [分享到 腾讯微博 新浪微博]
程序里面应该怎么写,请大侠帮帮我

使用道具 举报



Rank: 3Rank: 3

3#
发表于 2013-5-7 13:16:28 |只看该作者 | [分享到 腾讯微博 新浪微博]
自己顶一下

使用道具 举报



Rank: 8Rank: 8

4#
发表于 2013-5-7 13:19:30 |只看该作者 | [分享到 腾讯微博 新浪微博]
  1. //-------金魔方智能交易公式--------------
  2. //例0_8 时间函数 示例模型
  3. //该模型仅仅用来示范如何根据指标编写简单的模型
  4. //用户需要根据自己交易经验,进行修改后再实际应用!!!

  5. MA5:MA(C,5);//定义5周期的简单移动平均线
  6. MA10:MA(C,10);//定义10周期的简单移动平均线

  7. {9点05分之后14点55分之前的时间段内出现5周期线金叉10周期线}
  8. bEnterLong :=TIME>=090500 and TIME<145500 and CROSS(MA5,MA10);
  9. //时间到14点55分
  10. bExitLong :=TIME>=145500;

  11. //9点05分之后14点55分之前的时间段内出现5周期线死叉10周期线      
  12. bEnterShort :=TIME>=090500 and TIME<145500 and CROSS(MA10,MA5);
  13. //时间到14点55分
  14. bExitShort :=TIME>=145500;

  15. if bEnterLong then buy;
  16. if bExitLong then sell;
  17. if bEnterShort then SellShort;
  18. if bExitShort then BuyToCover;
复制代码运行代码
参考下。
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

5#
发表于 2013-5-7 13:28:05 |只看该作者 | [分享到 腾讯微博 新浪微博]
非常感谢,我学习下

使用道具 举报



Rank: 3Rank: 3

6#
发表于 2013-5-7 13:29:32 |只看该作者 | [分享到 腾讯微博 新浪微博]
还有个问题,我如果要取得股指期货最后一小时(14:15--15:15)的最高,最低,收盘应该怎么写?

使用道具 举报



Rank: 8Rank: 8

7#
发表于 2013-5-7 14:37:37 |只看该作者 | [分享到 腾讯微博 新浪微博]
#Run_By_Bar

variable:最后一小时h(0),
                 最后一小时l(0);
if Date <> Date[1] then
begin
        最后一小时l=0;
        最后一小时h=0;
end
if(time>=141500 and time <151500) then
begin
        if 最后一小时l=0 then 最后一小时l=l;
        最后一小时l=if(l<最后一小时l,l,最后一小时l);
        最后一小时h=if(h>最后一小时h,h,最后一小时h);
          
end
ll:最后一小时l;
hh:最后一小时h;
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

8#
发表于 2013-5-12 13:48:00 |只看该作者 | [分享到 腾讯微博 新浪微博]
感谢,再问个问题,怎么表示当前股指期货与沪深300之间的基差?即股指期货-沪深300指数?

使用道具 举报



Rank: 8Rank: 8

9#
发表于 2013-5-13 09:36:03 |只看该作者 | [分享到 腾讯微博 新浪微博]
winplusx 发表于 2013-5-12 13:48
感谢,再问个问题,怎么表示当前股指期货与沪深300之间的基差?即股指期货-沪深300指数? ...

期指上叠加hs300,
然后用公式:
基差:c-data2.c;
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

10#
发表于 2013-5-14 00:53:01 |只看该作者 | [分享到 腾讯微博 新浪微博]
如何在交易程序里写

使用道具 举报

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


bottom

Archiver|www.hs633.com ( 粤ICP备11107430号 )

GMT+8, 2024-5-18 23:28 , Processed in 0.093751 second(s), 8 queries .

花生网 Copyright©2012-2014

回顶部