指標轉交易程式碼如下
1.在交易時常有指標並無此進場訊號,但自動交易時卻執行了?
2.程式主要是希望周線圖W在 EMA12/26金叉之後的日期,有出現日線圖D在 EMA12/26的金叉,且在W/D兩個金叉之間,不可以有W的 EMA/12/26的死叉發生時才可進場,如何避免? (在日線圖會有跨頻率周線的金叉死叉訊號多次發生"死-金-死",周線圖上則只有"死")
if xf_EMA("D", Close,12) cross Over xf_EMA("D", Close,26) then begin
value1=currentBar;
//Plot1(value1,"日多");
end;
if xf_EMA("W", Close,12) cross Over xf_EMA("W", Close,26) then begin
value2=currentBar;
//Plot2(value2,"週多");
end;
if xf_EMA("M", Close,12) cross Over xf_EMA("M", Close,26) then begin
value3=currentBar;
//Plot3(value3,"月多");
end;
if xf_EMA("d", Close,12) cross under xf_EMA("d", Close,26) then begin
value4=currentBar;
//Plot4(value4,"日空");
end;
if xf_EMA("W", Close,12) cross under xf_EMA("W", Close,26) then begin
value5=currentBar;
//Plot5(value5,"週空");
end;
if xf_EMA("M", Close,12) cross under xf_EMA("M", Close,26) then begin
value6=currentBar;
//Plot6(value6,"月空");
end;
condition1=value6 < value3;//月多之後無月空
condition2=value5 < value2;// 周多之後無周空
condition3=value4 < value1;//日多之後無日空
condition4=value2 < value1 ;//周多之後有日多
if condition2 and condition3 and condition4 then setposition(1,market);
 
 
             
        
         
         
         
         
     
     分類
    分類
 
            
12 評論