MACD翻紅或翻黑警示

  •   312 
  • 最後發表   Albert988  2025 五月 16
Albert988 發文於   2025/05/15

請教各位大大
我想要60分MACD翻紅或者翻黑都跳出警示
不知道我這樣寫對不對
我的參數是短天數17.長天數45.macd天數17

 


input: FastLength(17), SlowLength(45), MACDLength(17);

 

variable: difValue(0), macdValue(0), oscValue(0);

 

 

 

SetTotalBar((maxlist(FastLength,SlowLength,6) + MACDLength) * 3 + 8);

 

 

 

SetInputName(1, "DIF短期期數");

 

SetInputName(2, "DIF長期期數");

 

SetInputName(3, "MACD期數");

 

 

 

MACD(weightedclose(), FastLength, SlowLength, MACDLength, difValue, macdValue, oscValue);

 

 

 

condition1 = trueall(oscValue < oscValue[1], 2) and oscValue > 0;  //連續2期 OSC 小於前期且 OSC 為紅柱

 

//condition1 = trueall(oscValue > oscValue[1], 2) and oscValue < 0;  //連續2期 OSC 大於前期且 OSC 為綠柱

 

 

 

if condition1 then ret = 1;

排序方式: 標準 | 最新
虎科大許教授 發文於   2025/05/15

condition1 = oscValue cross over 0; //黑翻紅

condition2 = oscValue cross under 0; //紅翻黑

Albert988 發文於   2025/05/15

請問我需要如何更改 因為我在這方面完全是小白 謝謝教授

Albert988 發文於   2025/05/15

這樣完整的腳本會是怎樣呢

虎科大許教授 發文於   2025/05/16

input: FastLength(17, "DIF短期期數"), SlowLength(45, "DIF長期期數"), MACDLength(17, "MACD期數");
variable: difValue(0), macdValue(0), oscValue(0);
SetTotalBar((maxlist(FastLength,SlowLength,6) + MACDLength) * 3 + 8);
MACD(weightedclose(), FastLength, SlowLength, MACDLength, difValue, macdValue, oscValue);
condition1 = oscValue cross over 0; //黑翻紅
condition2 = oscValue cross under 0; //紅翻黑
if condition1 or condition2 then ret = 1;

Albert988 發文於   2025/05/16

謝謝教授

發表回覆
Close