金字塔VBA日内交易策略源码[金字塔模型]

阅读 作者:股海网时间 2013-11-11 金字塔公式

dim ss
     ss = 1
 ''''''''''多头止损系数
 dim n1
     n1 = 10
 ''''''''''空头止损系数
 dim n2
     n2 = 10
   
 '''''''''  
 dim n3
     n3 = 4
   
 dim LastHigh
 dim LastLow
 dim LastClose
 dim Icode
 dim Imarket
 sub application_vbastart()
     call MarketData.RegReportNotify("if03","zj")
 end sub
 // www.guhai.com.cn

 sub MarketData_ReportNotify(ReportData)
     set ReportData = MarketData.GetReportData("if03","zj")
     NewPrice = ReportData.NewPrice
     LastHigh = ReportData.LastHigh
     'call application.MsgOut(LastHigh&" "&NewPrice)
   
     '''''''''''''''''持仓信息
     dim BuyHoding
     dim SellHoding
     dim BuyCost
     'dim SellHoding
     call order.HoldingInfoByCode2("if03","zj", BuyHoding, BuyCost, BuyTodayHoding, SellHoding, SellCost, SellTodayHoding, PNL, UseMargin,Account)
     ''''''''''''''''品种信息
     dim MinTick
     call order.Contract("if03","zj", Multipliter, MinTick, ShortPercent, LongPercent)
 '''''''''''''''''''''多头
 'BuyHoding=0 and SellHolding=0 and
     if Hour(Time) >09 and Hour(Time) <14 and    NewPrice>LastHigh and BuyHolding = 0 then
        call application.MsgOut("多头开!")
        call order.buy(1,ss,0,0,"if03","zj","",0)
     end if
 '''''''''''''''''''''空头
 'BuyHoding=0 and SellHolding=0 and
     if  Hour(Time) >09 and Hour(Time) <14 and   NewPrice<LastHigh and SellHolding = 0 then
        // 88gs.com
        call application.MsgOut("空头开!")
        call order.buyshort(1,ss,0,0,"if03","zj","",0)
     end if
 '''''''''''''''''''''多止损
     if BuyHoding>0 and NewPrice<BuyCost-n1*MinTick and Hour(Time) >09 and Hour(Time) <14 then
        call application.MsgOut("多头止损!")     
        call order.Sell(1,BuyHolding,0,0,"if03","zj","",0)
     end if
 '''''''''''''''''''''空止损
     if SellHoding>0 and NewPrice>BuyCost+n2*MinTick and Hour(Time) >09 and Hour(Time) <14 then
        call application.MsgOut("空头开!")  
        call order.SellShort(1,SellHolding,0,0,"if03","zj","",0)
     end if
 '''''''''''''''''''''日内平仓
     if Hour(Time) >= 14 and Hour(Time) <=15 then
        call application.MsgOut("收盘全平!")
        call order.Sell(1,BuyHolding,0,0,Icode,Imarket,"",1)
        call order.SellShort(1,SellHolding,0,0,"if03","zj","",1)
     end if
 End Sub
 
Sub UserForm1_CommandButton1_Click()
     call application.MsgOut(LastHigh&" "&NewPrice)
 End Sub
 

 

收藏
全部看法共 0 条
上传会员: 
股海网
上传时间: 
2013-11-11
下载积分: 
-
免责申明: 
请仔细阅读并同意后才能下载
本附件为用户分享上传,股海网没有对文件进行验证,不能保证下载资源的准确性、安全性和完整性,也不保证下载资源能正常安装和使用,且下载后扣除的积分无法退还,除非您充分理解并完全接受本声明,否则您无权下载。
本站对提供下载的软件、指标、资料等不拥有任何权利,其版权归该下载资源的合法拥有者所有。本附件仅供学习和研究,不得用于商业或非法用途,如有侵犯您的版权,请参看 《侵权处理流程》《免责声明条款》
点击下载无反应时,更换手机自带浏览器重登录操作,如华为浏览器,苹果Safari浏览器,第三方浏览器有不兼容现象,或先收藏再到电脑端下载。
同意以上声明才能下载,扣除积分无法退还!
我已知晓! 点我同意 所有条款自愿下载!
如有问题请点关闭提交问题反馈→
关闭

问题反馈 取消