Q1.選股策略-收盤價大於等於上軌,為什麼無法選出當天的K線觸上軌的?卻是昨天收盤價觸上軌
程式碼
Input: Length(12), UpperBand(2);
settotalbar(Length + 3);
SetInputName(1, "期數");
SetInputName(2, "通道上緣");
if close >= bollingerband(Close, Length, UpperBand)then ret =1 ;



Q2.MACD 盤中收盤價OSC綠柱轉紅柱, 選出來卻是昨天的綠柱轉紅柱不是當天收盤價?
程式碼:
input: FastLength(12), SlowLength(26), MACDLength(9);
variable: difValue(0), macdValue(0), oscValue(0);
SetTotalBar((maxlist(FastLength,SlowLength,6) + MACDLength) * 4);
SetInputName(1, "DIF短期期數");
SetInputName(2, "DIF長期期數");
SetInputName(3, "MACD期數");
setbarfreq("AD");
MACD(weightedclose(), FastLength, SlowLength, MACDLength, difValue, macdValue, oscValue);
if difValue > 0 and macdValue > 0 and oscValue[1] < 0 and oscValue > 0 then ret = 1;



7 評論