小編你好
我嘗試在週頻率上計算MACD oscValue 有幾根綠棒
在日頻率使用相同語法可行, 但換到週頻率就跑不出結果
input: FastLength(12), SlowLength(26), MACDLength(9);
variable: difValue(0), macdValue(0), oscValue(0),i(0),
_1st_G_1stBar(0),_1st_G_lastBar(0);
setbarfreq("W");
SetTotalBar((maxlist(FastLength,SlowLength,6) + MACDLength) * 4);
MACD(weightedclose, FastLength, SlowLength, MACDLength, difValue, macdValue, oscValue);
condition1 = Close > PriceLimit;
condition2 = difValue >0;
condition3 = macdValue >0;
condition4 = oscValue >0;
If condition1 and condition2 and condition3 and condition4 then
begin
i=0;
Repeat
Begin
if oscValue[i]>=0 then
i = i + 1;
End;
Until oscValue[i]<0;
_1st_G_1stBar =i; //第一根綠棒
Repeat
Begin
if oscValue[i]<=0 then
i = i + 1;
End;
Until oscValue[i]>0;
_1st_G_lastBar= i-1 ;//最後一根綠棒
5 評論