예스스탁
예스스탁 답변
2011-08-03 09:33:30
안녕하세요? 예스스탁입니다.
올리신 식으로 다시 작성해서 테스트 해보았는데, 두 개의 시점이 정확히 일치합니다. 지표식에서 값을 잘못 대입한 부분이 있는것 같습니다.
지표식과 강조식 다시 올려 드립니다.
먼저 올려주신 내용은 확인후 답변 드리도록 하겠습니다.
[지표식]
input : shortperiod(12), longPeriod(26), period(9);
var : macdosc(0), counter(0);
Array : MV[100,100](0);
value1 = MACD(shortPeriod, longPeriod); // shortPeriod:12 longPeriod:24
macdosc = value1-ema(value1,Period); // Period : 9
Plot1(value1, "MACD");
Plot2(ema(value1,Period), "MACDSignal");
counter = 0;
If CrossUp(macdosc,0) OR CrossDown(macdosc,0) Then
{
For counter = 0 to 49
{
MV[ 0 , 50 - Counter ] = MV[ 0 , 49 - Counter ];
MV[ 1 , 50 - Counter ] = MV[ 1 , 49 - Counter ];
MV[ 2 , 50 - Counter ] = MV[ 2 , 49 - Counter ];
}
MV[ 0 , 0 ] = Index;
MV[ 1, 0 ] = High;
MV[ 2, 0 ] = Low;
//MessageLog("%.2f, %.2f, %.2f", macdosc, MV[ 1 , 0 ],MV[ 2 , 0 ]);
}
if macdosc > 0 then
plot3(macdosc, "MACDOscillator", RED);
else
Plot3(macdosc, "MACDOscillator", BLUE);
PlotBaseLine1(0, "기준선1");
[강조식]
input : shortperiod(12), longPeriod(26), period(9);
var : macdosc(0), counter(0);
Array : MV[100,100](0);
value1 = MACD(shortPeriod, longPeriod); // shortPeriod:12 longPeriod:24
macdosc = value1-ema(value1,Period); // Period : 9
/*Plot1(value1, "MACD");
Plot2(ema(value1,Period), "MACDSignal");*/
counter = 0;
If CrossUp(macdosc,0) OR CrossDown(macdosc,0) Then
{
For counter = 0 to 49
{
MV[ 0 , 50 - Counter ] = MV[ 0 , 49 - Counter ];
MV[ 1 , 50 - Counter ] = MV[ 1 , 49 - Counter ];
MV[ 2 , 50 - Counter ] = MV[ 2 , 49 - Counter ];
}
MV[ 0 , 0 ] = Index;
MV[ 1, 0 ] = High;
MV[ 2, 0 ] = Low;
//MessageLog("%.2f, %.2f, %.2f", macdosc, MV[ 1 , 0 ],MV[ 2 , 0 ]);
}
if crossup(macdosc,0) then PlotPaintBar(close,open,"aa",yellow);
if crossdown(macdosc,0) then PlotPaintBar(close,open,"aa",cyan);