金字塔VBA日内交易策略源码

[复制链接]
查看924 | 回复0 | 2025-3-10 12:57:06 | 显示全部楼层 |阅读模式
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
// **.gumingtong.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 人打赏作者

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

本版积分规则

股鸣通是国内专业的股票公式指标资源在线共享平台,提供股票操盘软件用的各种指标公式,如:通达信指标公式、大智慧指标公式、同花顺指标公式等。
客服QQ:2728153965
欢迎入驻!本站将竭诚为您服务!
联系我们
  • 访问移动手机版
  • 官方微信客服

©2020-2025股鸣通 版权所有

|免责声明|手机版|小黑屋|股鸣通 ( 琼ICP备2025050731号|琼ICP备2025050731号-1 )

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