等级: 专业版
- 注册:
- 2022-1-11
- 曾用名:
|
请教,原来可以自动打开框架以及自动开启程序化交易了,升级6.3后不能了。VBA代码:
'打开框架使用:Application.ActiveFrame("IF_GZ_SHEnenge")
dim StartTime
dim StartTrade
dim HasDoClose
Sub APPLICATION_Start()
'''''''自动启动相应的框架(分日盘、夜盘调出相应图表,请自行叠加相应策略公式)
Call Application.ActivateFrame("IF_GZ_SHEnenge")
call application.Settimer(100,30000) '30秒时钟循环
StartTime = cdate(time)
StartTrade = 0
HasDoClose = 0
End Sub
Sub APPLICATION_Timer(ID)
if ID=100 then
if StartTrade=0 then
''''''''''''''启动图表交易
Set Wrap = CreateObject("DynamicWrapper")
Wrap.Register "user32.dll","FindWindowA","i=ss","f=s", "r=l"
Wrap.Register "user32.dll","FindWindowExA","i=llss","f=s", "r=l"
Wrap.Register "user32.dll","SendMessageA","i=lull","f=s", "r=l"
Wrap.Register "user32.dll","PostMessageA","i=lull","f=s", "r=l"
WM_CLOSE=16
WM_LBUTTONDOWN=513
WM_LBUTTONUP=514
h = Wrap.FindWindowA("#32770","图表程式化交易 - 金源广上 - 交易中") '框架名称请自行定义,下同
if h=0 then h = Wrap.FindWindowA("#32770","图表程式化交易 - 金源广上 - 交易中")
if h<>0 then
Wrap.PostMessageA h,WM_CLOSE,0,0
StartTrade=1
else
h = Wrap.FindWindowA("#32770","金字塔")
if h<>0 then
h2 = Wrap.FindWindowExA(h,0,"Button","是(&Y)")
if h2<>0 then
Wrap.SendMessageA h2,WM_LBUTTONDOWN,0,0
Wrap.SendMessageA h2,WM_LBUTTONUP,0,0
end if
else
h = Wrap.FindWindowA("#32770","图表程式化交易 - 金源广上 - 已停止")
if h=0 then h = Wrap.FindWindowA("#32770","图表程式化交易 - 金源广上 - 已停止")
if h<>0 then
h2 = Wrap.FindWindowExA(h,0,"Button","启动交易")
if h2<>0 then
Wrap.SendMessageA h2,WM_LBUTTONDOWN,0,0
Wrap.SendMessageA h2,WM_LBUTTONUP,0,0
end if
else
application.PostMessage(33873)
end if
end if
end if
end if
end sub
|
|