請問以下程式 我應該怎麼修改才對呢?
第一個雷達 期貨買進
variable: PositonL(0) ;
PositonL = PositonL[1] ;
////////////////////////////////////////////////////////////
variable: LowRec(99999) ; //低點記錄
variable: LowGo (10) ; //追漲點數
if PositonL = 0 then LowRec = minlist(l,LowRec);
if c - LowRec > LowGo and PositonL = 0 then //條件到 且 沒部位 才觸發
begin PositonL = 1 ; ret = 1 ;
LowRec =99999 ; end;
//////////////////////////////////////////////////////////
variable: HighRec(0) ; //高點記錄
variable: HighGo(10) ; //追跌點數
if PositonL = 1 then HighRec = maxlist(h,HighRec);
if HighRec - c > HighGo and PositonL = 1 then
begin PositonL = 0 ;
HighRec = 0 ; end;
以下雷達為多單出場 (其實跟上面雷達幾乎一樣 改ret位置而已)
variable: PositonLx(0) ;
PositonLx = PositonLx[1] ;
////////////////////////////////////////////////////////////
variable: LowRec(99999) ; //低點記錄
variable: LowGo (10) ; //追漲點數
if PositonLx = 0 then LowRec = minlist(l,LowRec);
if c - LowRec > LowGo and PositonLx = 0 then //條件到 且 沒部位 才觸發
begin PositonLx = 1 ;
LowRec =99999 ; end;
//////////////////////////////////////////////////////////
variable: HighRec(0) ; //高點記錄
variable: HighGo(10) ; //追跌點數
if PositonLx = 1 then HighRec = maxlist(h,HighRec);
if HighRec - c > HighGo and PositonLx = 1 then
begin PositonLx = 0 ; ret = 1;
HighRec = 0 ; end;
但有時候會沒平倉
或是多單重複執行
是甚麼原因呢? 要注意哪些設定嗎?
還是哪些XS觀念要修正呢?或是有更好的語法
感恩
4 評論