学习目的:得到一个在5分钟图上,比较精确控制开平仓时间的条件。。。
步骤:
1,先创建一个宏,用来生成一个文件:
'文件操作1:在指定目录创建文件,并且写入数据
Sub myTxtFile()
Dim oFso,strPath,oTxt,oTime1,oTime2
Set oFso=CreateObject("Scripting.FileSystemObject")
strPath=Application.AppPath&"MyFile\oTime.txt"
Set oTxt=oFso.CreateTextFile(strPath,true)
oTime1=90455
oTime2=90500
Do while oTime2<150000
oTxt.WriteLine oTime1&"<time and time<"&oTime2
oTime1=oTime1+500
oTime2=oTime2+500
Loop
oTxt.Close
End Sub
2,把这个文件在 UltraEdit 里处理成下面这种内容:
(90455<time and time<90500) Or (90955<time and time<91000) Or (91455<time and time<91500) Or (91955<time and time<92000) Or (92455<time and time<92500) Or (92955<time and time<93000) Or (93455<time and time<93500) Or (93955<time and time<94000) Or (94455<time and time<94500) Or (94955<time and time<95000) Or (95455<time and time<95500) Or (95955<time and time<10000) Or (100455<time and time<100500) Or (100955<time and time<101000) Or (101455<time and time<101500) Or (103455<time and time<103500) Or (103955<time and time<104000) Or (104455<time and time<104500) Or (104955<time and time<105000) Or (105455<time and time<105500) Or (105955<time and time<110000) Or (110455<time and time<110500) Or (110955<time and time<111000) Or (111455<time and time<111500) Or (111955<time and time<112000) Or (112455<time and time<112500) Or (112955<time and time<113000) Or (130455<time and time<130500) Or (130955<time and time<131000) Or (131455<time and time<131500) Or (131955<time and time<132000) Or (132455<time and time<132500) Or (132955<time and time<133000) Or (133455<time and time<133500) Or (133955<time and time<134000) Or (134455<time and time<134500) Or (134955<time and time<135000) Or (135455<time and time<135500) Or (135955<time and time<140000) Or (140455<time and time<140500) Or (140955<time and time<141000) Or (141455<time and time<141500) Or (141955<time and time<142000) Or (142455<time and time<142500) Or (142955<time and time<143000) Or (143455<time and time<143500) Or (143955<time and time<144000) Or (144455<time and time<144500) Or (144955<time and time<145000) Or (145455<time and time<145500) Or (145955<time and time<150000)
3,把这个作为开平仓的条件,加入到程式化交易的代码中。