171110.jpg  

 

 

簡單的 Multicharts語法範例 ~~~利用近期高低點當作移動停損停利

input:N(3);    設定外部可調整參數
vars:Kbar(0),HH(0),LL(0);   設定變數
if d[0]<>d[1] then value1=BarNumber;   當隔天的時候重新定義K棒的編號

Kbar= BarNumber-value1+1;   累計K棒的數目
if Kbar=N then begin   達到一定數目的時候
HH=highest(high,N);   取最近N根K棒最高點
LL=lowest(low,N);  取N根K棒最低點
end;

if  marketposition=1 and c>o and h>h[1] then LL=lowest(low,N);  當價格創新高,停損點往上移動
if  marketposition=-1 and c<o and l<l[1] then HH=highest(high,N); 當價格創新低,停損點往下移動

plot1(HH);  劃出停損線
plot2(LL);

arrow
arrow

    元大期貨楊宗儒 發表在 痞客邦 留言(0) 人氣()