커뮤니티
이지랭귀지로 작성된 코드인데 작동이 안됩니다
2010-03-01 14:52:23
1098
글번호 28447
이지랭귀지로 작성된 아래 지표가 차트상에 출력은 됩니다만
원래는 첨부 된 그림 처럼 나타나야 하나 엉뚱하게 나타납니다
EL을 체크해도 마찬가지이구요.
YT로 수식이 변환이 가능하다면 더 좋겠지만
이지랭귀지 호환모드로라도 쓸수 있으면 좋겠습니다.
메일로 답변 부탁드립니다.
--------------------이지랭귀지 소스------------------------
Inputs:
Price((H+L)/2);
Vars:
InPhase(0),
Quadrature(0),
Phase(0),
DeltaPhase(0),
count(0),
InstPeriod(0),
Period(0),
DCPhase(0),
RealPart(0),
ImagPart(0);
If CurrentBar > 5 then begin
{Compute InPhase and Quadrature components}
Value1 = Price - Price[6];
Value2 =Value1[3];
Value3 =.75*(Value1 - Value1[6]) + .25*(Value1[2] - Value1[4]);
InPhase = .33*Value2 + .67*InPhase[1];
Quadrature = .2*Value3 + .8*Quadrature[1];
{Use ArcTangent to compute the current phase}
If AbsValue(InPhase +InPhase[1]) > 0 then Phase =
ArcTangent(AbsValue((Quadrature+Quadrature[1]) / (InPhase+InPhase[1])));
{Resolve the ArcTangent ambiguity}
If InPhase < 0 and Quadrature > 0 then Phase = 180 - Phase;
If InPhase < 0 and Quadrature < 0 then Phase = 180 + Phase;
If InPhase > 0 and Quadrature < 0 then Phase = 360 - Phase;
{Compute a differential phase, resolve phase wraparound, and limit delta phase errors}
DeltaPhase = Phase[1] - Phase;
If Phase[1] < 90 and Phase > 270 then DeltaPhase = 360 + Phase[1] - Phase;
If DeltaPhase < 1 then DeltaPhase = 1;
If DeltaPhase > 60 then Deltaphase = 60;
{Sum DeltaPhases to reach 360 degrees. The sum is the instantaneous period.}
InstPeriod = 0;
Value4 = 0;
For count = 0 to 40 begin
Value4 = Value4 + DeltaPhase[count];
If Value4 > 360 and InstPeriod = 0 then begin
InstPeriod = count;
end;
end;
{Resolve Instantaneous Period errors and smooth}
If InstPeriod = 0 then InstPeriod = InstPeriod[1];
Value5 = .25*InstPeriod + .75*Value5[1];
{Compute Dominant Cycle Phase, Sine of the Phase Angle, and Leadsine}
Period = IntPortion(Value5);
RealPart = 0;
ImagPart = 0;
For count = 0 To Period - 1 begin
RealPart = RealPart + Sine(360 * count / Period) * (Price[count]);
ImagPart = ImagPart + Cosine(360 * count / Period) * (Price[count]);
end;
If AbsValue(ImagPart) > 0.001 then DCPhase = Arctangent(RealPart / ImagPart);
If AbsValue(ImagPart) <= 0.001 then DCPhase = 90 * Sign(RealPart);
DCPhase = DCPhase + 90;
If ImagPart < 0 then DCPhase = DCPhase + 180;
If DCPhase > 315 then DCPhase = DCPhase - 360;
Plot1(Sine(DCPhase), "Sine");
Plot2(Sine(DCPhase + 45), "LeadSine");
end;
- 1. tt.gif (0.02 MB)
답변 2
예스스탁 예스스탁 답변
2010-03-02 11:48:33
> hex 님이 쓴 글입니다.
> 제목 : 이지랭귀지로 작성된 코드인데 작동이 안됩니다
> 이지랭귀지로 작성된 아래 지표가 차트상에 출력은 됩니다만
원래는 첨부 된 그림 처럼 나타나야 하나 엉뚱하게 나타납니다
EL을 체크해도 마찬가지이구요.
YT로 수식이 변환이 가능하다면 더 좋겠지만
이지랭귀지 호환모드로라도 쓸수 있으면 좋겠습니다.
메일로 답변 부탁드립니다.
--------------------이지랭귀지 소스------------------------
Inputs:
Price((H+L)/2);
Vars:
InPhase(0),
Quadrature(0),
Phase(0),
DeltaPhase(0),
count(0),
InstPeriod(0),
Period(0),
DCPhase(0),
RealPart(0),
ImagPart(0);
If CurrentBar > 5 then begin
{Compute InPhase and Quadrature components}
Value1 = Price - Price[6];
Value2 =Value1[3];
Value3 =.75*(Value1 - Value1[6]) + .25*(Value1[2] - Value1[4]);
InPhase = .33*Value2 + .67*InPhase[1];
Quadrature = .2*Value3 + .8*Quadrature[1];
{Use ArcTangent to compute the current phase}
If AbsValue(InPhase +InPhase[1]) > 0 then Phase =
ArcTangent(AbsValue((Quadrature+Quadrature[1]) / (InPhase+InPhase[1])));
{Resolve the ArcTangent ambiguity}
If InPhase < 0 and Quadrature > 0 then Phase = 180 - Phase;
If InPhase < 0 and Quadrature < 0 then Phase = 180 + Phase;
If InPhase > 0 and Quadrature < 0 then Phase = 360 - Phase;
{Compute a differential phase, resolve phase wraparound, and limit delta phase errors}
DeltaPhase = Phase[1] - Phase;
If Phase[1] < 90 and Phase > 270 then DeltaPhase = 360 + Phase[1] - Phase;
If DeltaPhase < 1 then DeltaPhase = 1;
If DeltaPhase > 60 then Deltaphase = 60;
{Sum DeltaPhases to reach 360 degrees. The sum is the instantaneous period.}
InstPeriod = 0;
Value4 = 0;
For count = 0 to 40 begin
Value4 = Value4 + DeltaPhase[count];
If Value4 > 360 and InstPeriod = 0 then begin
InstPeriod = count;
end;
end;
{Resolve Instantaneous Period errors and smooth}
If InstPeriod = 0 then InstPeriod = InstPeriod[1];
Value5 = .25*InstPeriod + .75*Value5[1];
{Compute Dominant Cycle Phase, Sine of the Phase Angle, and Leadsine}
Period = IntPortion(Value5);
RealPart = 0;
ImagPart = 0;
For count = 0 To Period - 1 begin
RealPart = RealPart + Sine(360 * count / Period) * (Price[count]);
ImagPart = ImagPart + Cosine(360 * count / Period) * (Price[count]);
end;
If AbsValue(ImagPart) > 0.001 then DCPhase = Arctangent(RealPart / ImagPart);
If AbsValue(ImagPart) <= 0.001 then DCPhase = 90 * Sign(RealPart);
DCPhase = DCPhase + 90;
If ImagPart < 0 then DCPhase = DCPhase + 180;
If DCPhase > 315 then DCPhase = DCPhase - 360;
Plot1(Sine(DCPhase), "Sine");
Plot2(Sine(DCPhase + 45), "LeadSine");
end;
예스스탁 예스스탁 답변
2010-03-02 13:02:37
안녕하세요
예스스탁입니다.
메일이 반송이되어 게시판으로 남겨드립니다.
수식을 아래와 같이 변경했습니다.
다만 첨부하신 그림과 같이는 그려지지 않습니다.
TS 랭귀지에 문법 정도만 변경할 수 있어 첨부된 그림과 같이
식을 수정을 하지 못했습니다.
그림과 같이 수정을 해드리지 못해 죄송합니다.
Inputs:Price((H+L)/2);
Vars:InPhase(0),Quadrature(0),Phase(0),DeltaPhase(0),count(0),InstPeriod(0),Period(0),DCPhase(0),RealPart(0),ImagPart(0);
If CurrentBar > 5 then begin
#{Compute InPhase and Quadrature components}
Value1 = Price - Price[6];
Value2 = Value1[3];
Value3 = 0.75*(Value1 - Value1[6]) + 0.25*(Value1[2] - Value1[4]);
InPhase = 0.33*Value2 + 0.67*InPhase[1];
Quadrature = 0.2*Value3 + 0.8*Quadrature[1];
#{Use ArcTangent to compute the current phase}
If AbsValue(InPhase +InPhase[1]) > 0 then
Phase = ArcTangent(AbsValue((Quadrature+Quadrature[1]) / (InPhase+InPhase[1])));
#{Resolve the ArcTangent ambiguity}
If InPhase < 0 and Quadrature > 0 then Phase = 180 - Phase;
If InPhase < 0 and Quadrature < 0 then Phase = 180 + Phase;
If InPhase > 0 and Quadrature < 0 then Phase = 360 - Phase;
#{Compute a differential phase, resolve phase wraparound, and limit delta phase errors}
DeltaPhase = Phase[1] - Phase;
If Phase[1] < 90 and Phase > 270 then DeltaPhase = 360 + Phase[1] - Phase;
If DeltaPhase < 1 then DeltaPhase = 1;
If DeltaPhase > 60 then Deltaphase = 60;
#{Sum DeltaPhases to reach 360 degrees. The sum is the instantaneous period.}
InstPeriod = 0;
Value4 = 0;
For count = 0 to 40 begin
Value4 = Value4 + DeltaPhase[count];
If Value4 > 360 and InstPeriod == 0 then begin
InstPeriod = count;
end;
end;
#{Resolve Instantaneous Period errors and smooth}
If InstPeriod == 0 then
InstPeriod = InstPeriod[1];
Value5 = 0.25*InstPeriod + 0.75*Value5[1];
#{Compute Dominant Cycle Phase, Sine of the Phase Angle, and Leadsine}
Period = IntPortion(Value5);
RealPart = 0;
ImagPart = 0;
For count = 0 To Period - 1 begin
RealPart = RealPart + Sine(360 * count / Period) * (Price[count]);
ImagPart = ImagPart + Cosine(360 * count / Period) * (Price[count]);
end;
If AbsValue(ImagPart) > 0.001 then
DCPhase = Arctangent(RealPart / ImagPart);
If AbsValue(ImagPart) <= 0.001 then
DCPhase = 90 * Sign(RealPart);
DCPhase = DCPhase + 90;
If ImagPart < 0 then
DCPhase = DCPhase + 180;
If DCPhase > 315 then
DCPhase = DCPhase - 360;
Plot1(Sine(DCPhase), "Sine");
Plot2(Sine(DCPhase + 45), "LeadSine");
end;
즐거운 하루되세요
> hex 님이 쓴 글입니다.
> 제목 : 이지랭귀지로 작성된 코드인데 작동이 안됩니다
> 이지랭귀지로 작성된 아래 지표가 차트상에 출력은 됩니다만
원래는 첨부 된 그림 처럼 나타나야 하나 엉뚱하게 나타납니다
EL을 체크해도 마찬가지이구요.
YT로 수식이 변환이 가능하다면 더 좋겠지만
이지랭귀지 호환모드로라도 쓸수 있으면 좋겠습니다.
메일로 답변 부탁드립니다.
--------------------이지랭귀지 소스------------------------
Inputs:
Price((H+L)/2);
Vars:
InPhase(0),
Quadrature(0),
Phase(0),
DeltaPhase(0),
count(0),
InstPeriod(0),
Period(0),
DCPhase(0),
RealPart(0),
ImagPart(0);
If CurrentBar > 5 then begin
{Compute InPhase and Quadrature components}
Value1 = Price - Price[6];
Value2 =Value1[3];
Value3 =.75*(Value1 - Value1[6]) + .25*(Value1[2] - Value1[4]);
InPhase = .33*Value2 + .67*InPhase[1];
Quadrature = .2*Value3 + .8*Quadrature[1];
{Use ArcTangent to compute the current phase}
If AbsValue(InPhase +InPhase[1]) > 0 then Phase =
ArcTangent(AbsValue((Quadrature+Quadrature[1]) / (InPhase+InPhase[1])));
{Resolve the ArcTangent ambiguity}
If InPhase < 0 and Quadrature > 0 then Phase = 180 - Phase;
If InPhase < 0 and Quadrature < 0 then Phase = 180 + Phase;
If InPhase > 0 and Quadrature < 0 then Phase = 360 - Phase;
{Compute a differential phase, resolve phase wraparound, and limit delta phase errors}
DeltaPhase = Phase[1] - Phase;
If Phase[1] < 90 and Phase > 270 then DeltaPhase = 360 + Phase[1] - Phase;
If DeltaPhase < 1 then DeltaPhase = 1;
If DeltaPhase > 60 then Deltaphase = 60;
{Sum DeltaPhases to reach 360 degrees. The sum is the instantaneous period.}
InstPeriod = 0;
Value4 = 0;
For count = 0 to 40 begin
Value4 = Value4 + DeltaPhase[count];
If Value4 > 360 and InstPeriod = 0 then begin
InstPeriod = count;
end;
end;
{Resolve Instantaneous Period errors and smooth}
If InstPeriod = 0 then InstPeriod = InstPeriod[1];
Value5 = .25*InstPeriod + .75*Value5[1];
{Compute Dominant Cycle Phase, Sine of the Phase Angle, and Leadsine}
Period = IntPortion(Value5);
RealPart = 0;
ImagPart = 0;
For count = 0 To Period - 1 begin
RealPart = RealPart + Sine(360 * count / Period) * (Price[count]);
ImagPart = ImagPart + Cosine(360 * count / Period) * (Price[count]);
end;
If AbsValue(ImagPart) > 0.001 then DCPhase = Arctangent(RealPart / ImagPart);
If AbsValue(ImagPart) <= 0.001 then DCPhase = 90 * Sign(RealPart);
DCPhase = DCPhase + 90;
If ImagPart < 0 then DCPhase = DCPhase + 180;
If DCPhase > 315 then DCPhase = DCPhase - 360;
Plot1(Sine(DCPhase), "Sine");
Plot2(Sine(DCPhase + 45), "LeadSine");
end;
다음글
이전글