大家好:
今天要來講當MACD為綠柱時,要如何標出這區間的股價低點位置??

程式碼如下:
// XQ: MACD指標
//
input: FastLength(12), SlowLength(26), MACDLength(9);
variable: price(0);
SetInputName(1, "DIF短天數");
SetInputName(2, "DIF長天數");
SetInputName(3, "MACD天數");
price = WeightedClose();
Value1 = XAverage(price, FastLength) - XAverage(price, SlowLength);
Value2 = XAverage(Value1, MACDLength) ;
Value3 = Value1 - Value2 ;
// 前面區段資料變動較大, 先不繪出
//
if CurrentBar <= SlowLength then
begin
Value1 = 0;
Value2 = 0;
Value3 = 0;
end;
value4 =low;
if value3 < 0 then
begin
if low < value4[1] then begin
value4 = low;
end
else begin
value4 = value4[1];
end;
plot4(value4,"low");
end
else
begin
noplot(4);
end;
以上提供大家參考
2 評論