想請問如果想要(指標)裡面的修正移動平均線(如下)想要穿越布林指標的(中軌)(如下),並且寫成警示提醒,該怎麼寫,
(指標)裡面的修正移動平均線如下
input:n(20,"計算期數");
variable: w(0);
if barfreq = "Tick" or barfreq = "Min" then
begin
value1=GetField("內盤量");//單位:元
value2=GetField("外盤量");//單位:元
end else begin
value1=GetField("內盤量","D");//單位:元
value2=GetField("外盤量","D");//單位:元
end;
//計算內外盤比
if value2<>0 then
value3=value1/value2*100
else
value3=100;
if close>close[1] then begin
if value3>130 then
w=2.5
else if value3>120 then
w=2.2
else if value3>110 then
w=2.1
else if value3>100 then
w=1.9
else
w=1.8;
end else if value3<70 then
w=2.5
else if value3<80 then
w=2.2
else if value3<90 then
w=2.1
else if value3<100 then
w=1.9
else
w=1.8;
value4=(w/(n+1))*close+(n-1)/(n+1)*value4[1];
value5=average(close,n);
plot2(value5,"移動平均線");
布林指標的(中軌)(如下)
input:Length(40,"布林通道MA的天數"),
UpperBand(3,"上通道標準差倍數"),
LowerBand(3,"下通道標準差倍數");
variable:mid(0),up(0),down(0);
up = bollingerband(Close,Length,UpperBand) ;
mid = average(close,Length);
down = bollingerband(Close,Length,-1*LowerBand);
plot1(up,"UB");
plot2(mid,"BBandMA");
plot3(down,"LB");
4 評論