延續使用均線交叉的策略,均線的參數是18,50 接下來就是檢視自己的想法對不對。
1.均線交叉向上後,訊號出現後三日前的最高點為壓力,若在五天內價格大於等於三日前的最高點則表示可以買進。
2.均線交叉向下後,訊號出現後三日前的最低點為支撐,若在五天內價格小於等於三日前的最低點則表示可以賣出。


Input: Price(Close), Length1(18), Length2(50), Displace(0);
Vars: ViewLen(3), EntLen(5),FastMA(0),LowMA(0),EntPriceL(0),EntPriceS(0),LEntBar(-999),LEntPrice(0),SEntPrice(0),SEntBar(0),PlotEnt(0);


If Displace >= 0 OR CurrentBar > AbsValue(Displace) Then Begin
 FastMA = AverageFC(Price, Length1);
 LowMA  = AverageFC(Price, Length2);
  
 IF FastMA Crosses Above LowMA  Then Begin
    EntPriceL = Highest(H,ViewLen);
     LEntBar = BarNumber;
    End
    Else
    IF FastMA Crosses Below LowMA  Then Begin
       EntPriceS = Lowest(L,ViewLen);
       SEntBar = BarNumber ;
    End;

{Bullish}
    If BarNumber < LEntBar + EntLen then Begin
        IF C >=  EntPriceL then Begin
   Plot1(EntPriceL,"Long Price");
  End;
 End;

{Bearish}
    If BarNumber < SEntBar + EntLen then Begin
       IF C <= EntPriceS then Begin
    Plot2(EntPriceS , "Short Price");
       End;
 End;
 
End;



arrow
arrow
    全站熱搜

    curtischang 發表在 痞客邦 留言(0) 人氣()