if GetSymbolInfo("買賣現沖")=false or GetSymbolInfo("處置股")=true then raiseruntimeerror("不可當沖");
///變數定義
variable:flag(0),_low(0),_low2(0),barcount(0),flag1bar(0),flag2bar(0),flag3bar(0),flag4bar(0),flag1count(0),flag4count(0),flag5count(0)
,flag6count(0),_sellcount(0),_low11(0),_lowperiod2(0),_periodhigh2(0),_period2(0),flag7count(0),_highperiodtime(0),_highperiodtime2(0),
recordhigh(0),arecord(0),alow(0),condition3_(0),AAA(0),barcount1(0),M(0),_sellprice(0),_switch(0),positioncount(0),
volumeflag1(0),flag1highvolumebar(0),i(0),tv(0),tp(0),close2(0),_high2(0),_true(0),highcount(0),volhigh(0),vollowprice(0),volhigh2(0),_period(0),_periodhigh(0),_lowperiod(0);
VARiable:INTRaBarPersist flagnum(0),_high(0);
//////////////////////////////////////////////////////////////////////////選股邏輯//////////////////////////////////////////////////////////////////////
///barcount 定義///
if date <> date[1] then ///參數定義
begin
barcount=1;
end
else
barcount+=1;
////////////////////////////////////////////////////////判斷價位區間
if c>10 and c<20 then _switch=10;
if c>20 and c<30 then _switch=20;
if c>30 and c<40 then _switch=30;
if c>40 and c<50 then _switch=40;
if c>50 and c<60 then _switch=50;
if c>60 and c<70 then _switch=60;
if c>70 and c<80 then _switch=70;
if c>80 and c<90 then _switch=80;
if c>90 and c<100 then _switch=90;
if c>100 then _switch=100;
///下單張數
positioncount=Round(300/c,0);
//////////////////////////////////////////////////////////////////////////////////進場條件////////////////////////////////////////////////////////////
//////////////////////////////
if c>_avgprice and GetField("成交量", "D")[1]>500 and _estvolume99>4
then begin
setposition(1);
end;
print(file("C:\print\"),date,barcount,position,c,_avgprice,GetField("成交量", "D")[1],_estvolume99);
以上為程式碼,以下為print出來的結果
可以看到其中一項進場條件為_estvolume99>4才進場,可是print出來看只有0.6多
卻觸發進場,今天盤中開起來自動交易模擬有進場 回測結果也是如此
請問小幫手這個情況該怎麼解決?
date, barcount, position, c, _avgprice , GetField("成交量", "D")[1], _estvolume99
20230328.000000 143.000000 0.000000 40.250000 39.772378 48104.000000 0.642940
20230328.000000 143.000000 1.000000 40.200000 39.773384 48104.000000 0.648012
20230328.000000 144.000000 1.000000 40.150000 39.774456 48104.000000 0.648552



5 評論