|  | 
 
 楼主|
发表于 2015-2-14 04:54 PM
|
显示全部楼层 
| 如果你使用TD Ameritrade的ThinkorSwim,4xMACD的编码如下: 
 declare lower;
 input fastLength = 48;
 input slowLength = 104;
 input MACDLength = 36;
 input averageType = AverageType.EXPONENTIAL;
 plot Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
 plot Avg = MovingAverage(averageType, Value, MACDLength);
 plot Diff = Value - Avg;
 plot ZeroLine = 0;
 Value.SetDefaultColor(GetColor(1));
 Avg.SetDefaultColor(GetColor(8));
 Diff.SetDefaultColor(GetColor(5));
 Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
 Diff.SetLineWeight(3);
 Diff.DefineColor("Positive and Up", Color.GREEN);
 Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
 Diff.DefineColor("Negative and Down", Color.RED);
 Diff.DefineColor("Negative and Up", Color.DARK_RED);
 Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up") else
 Diff.color("Positive and Down") else if Diff < Diff[1] then Diff.color("Negative and Down") else Diff.color
 ("Negative and Up"));
 ZeroLine.SetDefaultColor(GetColor(0));
 
 | 
 |