커뮤니티
제가 수정한 식에 어디가 잘못된건가요?
2015-06-19 12:16:51
260
글번호 87406
기존수식
inputs: Length (NumericSeries);
Vars : WtCRatio(1), VolRatio(1), VolAvg(Volume),
BuyP(1), SellP(1), Sign(+1), Return(0),
WghtClose(Close), AvgTR(High - Low),
Constant(1), BuyPres(1), SellPres(1),
TempDI(1), DMIndx(1);
If CurrentBar = 1 then
Begin
VolAvg = Average(Volume, Length);
End;
Return = 0 ;
WghtClose = (High + Low + Close + Close) * 0.25;
AvgTR = Average (Highest (High, 2) - Lowest ( Low, 2), Length);
VolAvg = ((VolAvg [1] * (Length - 1)) + Volume) / Length;
If WghtClose <> 0 and WghtClose[1] <> 0 and
AvgTR <> 0 and VolAvg <> 0 then
Begin
WtCRatio = (WghtClose - WghtClose[1]) / MinList(WghtClose,WghtClose[1]) ;
VolRatio = Volume / VolAvg;
Constant = ((WghtClose * 3) /AvgTR) * AbsValue (WtCRatio);
If Constant > 88 then Constant = 88;
Constant = VolRatio / ExpValue (Constant);
If WtCRatio > 0 then
Begin
BuyP = VolRatio;
SellP = Constant;
End
Else
Begin
BuyP = Constant;
SellP = VolRatio;
End;
BuyPres = ((BuyPres [1] * (Length - 1)) + BuyP) / Length;
SellPres = ((SellPres [1] * (Length - 1)) + SellP) / Length;
TempDI = +1;
If SellPres > BuyPres then
Begin
Sign = -1;
If SellPres <> 0 then TempDI = BuyPres / SellPres;
End
Else
Begin
Sign = +1;
If BuyPres <> 0 then TempDI = SellPres / BuyPres;
End;
TempDI = TempDI * Sign;
If TempDI < 0 then
DMIndx = -1 - TempDI
else
DMIndx = +1 - TempDI ;
Return = DMIndx {* 100.0} ;
End;
DemandIndex = Return ;
Inputs: Length(5);
Vars: DMIndx(0);
DMIndx = DeMandIndex (Length) ;
Plot1(DMIndx, "DMI") ;
Plot2(0, "Zero") ;
직접 수정한 수식
Inputs: Length (19);
Vars : WtCRatio(1), VolRatio(1), VolAvg(Volume),
BuyP(1), SellP(1), Sign(1), Return(0),
WghtClose(Close), AvgTR(High - Low),
Constant(1), BuyPres(1), SellPres(1),
TempDI(1), DMIndx(1), DemandIndex(0);
VolAvg = Average(Volume, Length);
Return = 0 ;
WghtClose = (High + Low + Close + Close) * 0.25;
AvgTR = Average (Highest (High, 2) - Lowest ( Low, 2), Length);
VolAvg = ((VolAvg [1] * (Length - 1)) + Volume) / Length;
If WghtClose <> 0 and WghtClose[1] <> 0 and
AvgTR <> 0 and VolAvg <> 0 then
Begin
WtCRatio = (WghtClose - WghtClose[1]) / MinList(WghtClose,WghtClose[1]) ;
VolRatio = Volume / VolAvg;
Constant = ((WghtClose * 3) /AvgTR) * AbsValue (WtCRatio);
If Constant > 88 then Constant = 88;
Constant = VolRatio / ExpValue (Constant);
If WtCRatio > 0 then
Begin
BuyP = VolRatio;
SellP = Constant;
End
Else
Begin
BuyP = Constant;
SellP = VolRatio;
End;
BuyPres = ((BuyPres [1] * (Length - 1)) + BuyP) / Length;
SellPres = ((SellPres [1] * (Length - 1)) + SellP) / Length;
TempDI +1;
If SellPres > BuyPres then
Begin
Sign = -1;
If SellPres <> 0 then TempDI = BuyPres / SellPres;
End
Else
Begin
Sign = 1;
If BuyPres <> 0 then TempDI = SellPres / BuyPres;
End;
TempDI = TempDI * Sign;
If TempDI < 0 then
DMIndx = -1 - TempDI ;
else
DMIndx = 1 - TempDI ;
{
Return = DMIndx * 100.0 ;
}
End;
DemandIndex = Return ;
DMIndx = DeMandIndex[Length] ;
Plot1(DMIndx, "DMI") ;
Plot2(0, "Zero") ;
답변 1
예스스탁 예스스탁 답변
2015-06-19 14:58:57
안녕하세요
예스스탁입니다.
1
VolAvg = ((VolAvg[1] * (Length - 1)) + Volume) / Length;
차트 첫봉에는 해당 변수의 1봉전 값이 없습니다.
VolAvg = ((VolAvg * (Length - 1)) + Volume) / Length;
와 같이 처리하시면 됩니다.
2
DMIndx = DeMandIndex[Length] ;
는 Length봉전 값을 저장하는 내용입니다.
현재봉 값은 원본 수식 내용상 아래와 같이 처리하시면 됩니다.
DMIndx = DeMandIndex;
수정한 식입니다.
Inputs: Length (19);
Vars : WtCRatio(1), VolRatio(1), VolAvg(Volume),
BuyP(1), SellP(1), Sign(1), Return(0),
WghtClose(Close), AvgTR(High - Low),
Constant(1), BuyPres(1), SellPres(1),
TempDI(1), DMIndx(1), DemandIndex(0);
VolAvg = Average(Volume, Length);
Return = 0 ;
WghtClose = (High + Low + Close + Close) * 0.25;
AvgTR = Average (Highest (High, 2) - Lowest ( Low, 2), Length);
VolAvg = ((VolAvg * (Length - 1)) + Volume) / Length;
If WghtClose <> 0 and WghtClose[1] <> 0 and
AvgTR <> 0 and VolAvg <> 0 then
Begin
WtCRatio = (WghtClose - WghtClose[1]) / MinList(WghtClose,WghtClose[1]) ;
VolRatio = Volume / VolAvg;
Constant = ((WghtClose * 3) /AvgTR) * AbsValue (WtCRatio);
If Constant > 88 then Constant = 88;
Constant = VolRatio / ExpValue (Constant);
If WtCRatio > 0 then
Begin
BuyP = VolRatio;
SellP = Constant;
End
Else
Begin
BuyP = Constant;
SellP = VolRatio;
End;
BuyPres = ((BuyPres [1] * (Length - 1)) + BuyP) / Length;
SellPres = ((SellPres [1] * (Length - 1)) + SellP) / Length;
TempDI +1;
If SellPres > BuyPres then
Begin
Sign = -1;
If SellPres <> 0 then TempDI = BuyPres / SellPres;
End
Else
Begin
Sign = 1;
If BuyPres <> 0 then TempDI = SellPres / BuyPres;
End;
TempDI = TempDI * Sign;
If TempDI < 0 then
DMIndx = -1 - TempDI ;
else
DMIndx = 1 - TempDI ;
{
Return = DMIndx * 100.0 ;
}
End;
DemandIndex = Return ;
DMIndx = DeMandIndex ;
Plot1(DMIndx, "DMI") ;
Plot2(0, "Zero") ;
즐거운 하루되세요
> ijh0316 님이 쓴 글입니다.
> 제목 : 제가 수정한 식에 어디가 잘못된건가요?
> 기존수식
inputs: Length (NumericSeries);
Vars : WtCRatio(1), VolRatio(1), VolAvg(Volume),
BuyP(1), SellP(1), Sign(+1), Return(0),
WghtClose(Close), AvgTR(High - Low),
Constant(1), BuyPres(1), SellPres(1),
TempDI(1), DMIndx(1);
If CurrentBar = 1 then
Begin
VolAvg = Average(Volume, Length);
End;
Return = 0 ;
WghtClose = (High + Low + Close + Close) * 0.25;
AvgTR = Average (Highest (High, 2) - Lowest ( Low, 2), Length);
VolAvg = ((VolAvg [1] * (Length - 1)) + Volume) / Length;
If WghtClose <> 0 and WghtClose[1] <> 0 and
AvgTR <> 0 and VolAvg <> 0 then
Begin
WtCRatio = (WghtClose - WghtClose[1]) / MinList(WghtClose,WghtClose[1]) ;
VolRatio = Volume / VolAvg;
Constant = ((WghtClose * 3) /AvgTR) * AbsValue (WtCRatio);
If Constant > 88 then Constant = 88;
Constant = VolRatio / ExpValue (Constant);
If WtCRatio > 0 then
Begin
BuyP = VolRatio;
SellP = Constant;
End
Else
Begin
BuyP = Constant;
SellP = VolRatio;
End;
BuyPres = ((BuyPres [1] * (Length - 1)) + BuyP) / Length;
SellPres = ((SellPres [1] * (Length - 1)) + SellP) / Length;
TempDI = +1;
If SellPres > BuyPres then
Begin
Sign = -1;
If SellPres <> 0 then TempDI = BuyPres / SellPres;
End
Else
Begin
Sign = +1;
If BuyPres <> 0 then TempDI = SellPres / BuyPres;
End;
TempDI = TempDI * Sign;
If TempDI < 0 then
DMIndx = -1 - TempDI
else
DMIndx = +1 - TempDI ;
Return = DMIndx {* 100.0} ;
End;
DemandIndex = Return ;
Inputs: Length(5);
Vars: DMIndx(0);
DMIndx = DeMandIndex (Length) ;
Plot1(DMIndx, "DMI") ;
Plot2(0, "Zero") ;
직접 수정한 수식
Inputs: Length (19);
Vars : WtCRatio(1), VolRatio(1), VolAvg(Volume),
BuyP(1), SellP(1), Sign(1), Return(0),
WghtClose(Close), AvgTR(High - Low),
Constant(1), BuyPres(1), SellPres(1),
TempDI(1), DMIndx(1), DemandIndex(0);
VolAvg = Average(Volume, Length);
Return = 0 ;
WghtClose = (High + Low + Close + Close) * 0.25;
AvgTR = Average (Highest (High, 2) - Lowest ( Low, 2), Length);
VolAvg = ((VolAvg [1] * (Length - 1)) + Volume) / Length;
If WghtClose <> 0 and WghtClose[1] <> 0 and
AvgTR <> 0 and VolAvg <> 0 then
Begin
WtCRatio = (WghtClose - WghtClose[1]) / MinList(WghtClose,WghtClose[1]) ;
VolRatio = Volume / VolAvg;
Constant = ((WghtClose * 3) /AvgTR) * AbsValue (WtCRatio);
If Constant > 88 then Constant = 88;
Constant = VolRatio / ExpValue (Constant);
If WtCRatio > 0 then
Begin
BuyP = VolRatio;
SellP = Constant;
End
Else
Begin
BuyP = Constant;
SellP = VolRatio;
End;
BuyPres = ((BuyPres [1] * (Length - 1)) + BuyP) / Length;
SellPres = ((SellPres [1] * (Length - 1)) + SellP) / Length;
TempDI +1;
If SellPres > BuyPres then
Begin
Sign = -1;
If SellPres <> 0 then TempDI = BuyPres / SellPres;
End
Else
Begin
Sign = 1;
If BuyPres <> 0 then TempDI = SellPres / BuyPres;
End;
TempDI = TempDI * Sign;
If TempDI < 0 then
DMIndx = -1 - TempDI ;
else
DMIndx = 1 - TempDI ;
{
Return = DMIndx * 100.0 ;
}
End;
DemandIndex = Return ;
DMIndx = DeMandIndex[Length] ;
Plot1(DMIndx, "DMI") ;
Plot2(0, "Zero") ;