커뮤니티
도와주세요~
2009-03-04 16:15:51
767
글번호 20651
인베스트라에 나오는 로직인에
yt에 추세선 개념이 없는것 같아서요
이런 로직을 사용하려면 어떻게 짜야할까요
불가능할것 같진않은데,,
yt로 사용할수 있게 도와주세요ㅣ~~
) Setup
a) 10개의 swing high bars를 찾는다. 이전 4개의 bars 보다 값이 크거나 같고, 이후 4개의 bars 보다 값이 큰 고가(high)를 가지는 bar를 swing high bar로 정의한다.
b) 10개의 swing low bars를 찾는다. 이전 4개의 bars 보다 값이 작거나 같고, 이후 4개의 bars 보다 값이 작은 저가(low)를 가지는 bar를 swing low bar로 정의한다.
c) 만약 가장 최근의 swing high 가 이전 9개의 swing highs 중 어떠한 하나 보다 값이 작다면 이 두 개의 swing high를 연결하는 추세선을 그리고 이것을 오른쪽으로 연장한다. 이것이 하향(down-trend) 추세선이다.
d) 만약 가장 최근의 swing low 가 이 전 9개의 swing lows 중 어떠한 하나 보다 값이 크다면 이 두 개의 swing low를 연결하는 추세선을 그리고 이것을 오른쪽으로 연장한다. 이것이 상향(up-trend) 추세선이다.
2) 매수 진입
e) 만약 현재 바의 종가가 하향 추세선을 상향 돌파하고 이 추세선의 기울기가 10° 이상이면 다음 바의 시가에 매수 진입한다.
3) 매도 진입
f) 만약 현재 바의 종가가 상향 추세선을 하향 돌파하고 이 추세선의 기울기가 10° 이상이면 다음 바의 시가에 매도 진입한다.
4) 청산
g) 최근 6개의 bars보다 low 값이 작으면 매수 포지션을 청산한다.
h) 최근 6개의 bars보다 high 값이 크면 매도 포지션을 청산한다.
Inputs: RHStren(4), RLStren(4), Trailbar(6);
Vars: RHTLRef(-1), RHTLRef2(-1), RHSet(-1), RHSet2(-1), RHArrayVal(0), RHColorVar(0), RLColorVar(0), BarsPast(0);
Vars: RLTLRef(-1), RLTLRef2(-1), RLSet(-1), RLSet2(-1),RLArrayVal(0), BuyPrice(0), PrevBuyPrice(0), SellPrice(0), PrevSellPrice(0);
Array: RHDate[10](0), RHTime[10](0), RHVal[10](0);
Array: RLDate[10](99999), RLTime[10](99999), RLVal[10](99999);
If SwingHighBar(1, High, RHStren, RHStren+1)=RHStren then begin
for Value1=9 downto 0 begin
RHDate[Value1+1]=RHDate[Value1];
RHTime[Value1+1]=RHTime[Value1];
RHVal[Value1+1]=RHVal[Value1];
end;
RHDate[0]=Date[RHStren];
RHTime[0]=Time[RHStren];
RHVal[0]=High[RHStren];
for Value22=1 to 10 begin
If RHVal[Value22]>RHVal[0] then begin
RHArrayVal=Value22;
Value22=11;
end;
End;
If Value22<>11 then begin
If RHSet>=0 then begin
RHSet2=TL_SetExtRight(RHTLRef, False);
TL_Delete(RHTLRef);
end;
RHTLRef=TL_New(RHDate[RHArrayVal], RHTime[RHArrayVal], RHVal[RHArrayVal], RHDate[0], RHTime[0], RHVal[0]);
RHSet=TL_SetExtRight(RHTLRef, True);
End;
End;
{ Find new Swing Low bars and draw corresponding trend lines }
If SwingLowBar(1, Low, RLStren, RLStren+1)=RLStren then begin
for Value1=9 downto 0 begin
RLDate[Value1+1]=RLDate[Value1];
RLTime[Value1+1]=RLTime[Value1];
RLVal[Value1+1]=RLVal[Value1];
end;
RLDate[0]=Date[RLStren];
RLTime[0]=Time[RLStren];
RLVal[0]=Low[RLStren];
for Value22=1 to 10 begin
If RLVal[Value22] RLArrayVal=Value22;
Value22=11;
end;
End;
If Value22<>11 then begin
If RLSet>=0 then begin
RLTLRef2=TL_SetEnd(RLTLRef, Date,Time,TL_GetValue(RLTLRef, date, time));
RLSet2=TL_SetExtRight(RLTLRef, False);
TL_Delete(RLTLRef);
end;
RLTLRef=TL_New(RLDate[RLArrayVal], RLTime[RLArrayVal], RLVal[RLArrayVal], RLDate[0], RLTime[0], RLVal[0]);
RLSet=TL_SetExtRight(RLTLRef, True);
End;
End;
{ Place orders to enter long positions }
If RHTLRef <> -1 then Begin
BuyPrice = TL_GetValue( RHTLRef , Date, Time );
PrevBuyPrice = TL_Getvalue( RHTLRef , Date[1] , Time[1] );
If Close Crosses Over BuyPrice AND Arctangent( PrevBuyPrice / BuyPrice)>10 then
Buy next bar at Market;
End;
{ Place orders to enter short positions }
If RLTLRef <> -1 then Begin
SellPrice = TL_GetValue( RLTLRef , Date , Time );
PrevSellPrice = TL_Getvalue( RLTLRef , Date[1] , Time[1] );
If Close crosses under SellPrice AND Arctangent(SellPrice / PrevSellPrice)>10 then
Sell next bar at Market;
End;
{ Trailing protective stop orders }
ExitLong next bar at Lowest( Low , TrailBar ) Stop;
ExitShort next bar at Highest( High , TrailBar ) Stop;
답변 1
예스스탁 예스스탁 답변
2009-03-05 14:52:54
안녕하세요
예스스탁입니다.
추세선 함수가 지원되지 않아 문의하신 부분은 식으로 작성이 어렵습니다.
도움을 드리지 못해 죄송합니다.
즐거운 하루도세요
> 감사해여므지 님이 쓴 글입니다.
> 제목 : 도와주세요~
> 인베스트라에 나오는 로직인에
yt에 추세선 개념이 없는것 같아서요
이런 로직을 사용하려면 어떻게 짜야할까요
불가능할것 같진않은데,,
yt로 사용할수 있게 도와주세요ㅣ~~
) Setup
a) 10개의 swing high bars를 찾는다. 이전 4개의 bars 보다 값이 크거나 같고, 이후 4개의 bars 보다 값이 큰 고가(high)를 가지는 bar를 swing high bar로 정의한다.
b) 10개의 swing low bars를 찾는다. 이전 4개의 bars 보다 값이 작거나 같고, 이후 4개의 bars 보다 값이 작은 저가(low)를 가지는 bar를 swing low bar로 정의한다.
c) 만약 가장 최근의 swing high 가 이전 9개의 swing highs 중 어떠한 하나 보다 값이 작다면 이 두 개의 swing high를 연결하는 추세선을 그리고 이것을 오른쪽으로 연장한다. 이것이 하향(down-trend) 추세선이다.
d) 만약 가장 최근의 swing low 가 이 전 9개의 swing lows 중 어떠한 하나 보다 값이 크다면 이 두 개의 swing low를 연결하는 추세선을 그리고 이것을 오른쪽으로 연장한다. 이것이 상향(up-trend) 추세선이다.
2) 매수 진입
e) 만약 현재 바의 종가가 하향 추세선을 상향 돌파하고 이 추세선의 기울기가 10° 이상이면 다음 바의 시가에 매수 진입한다.
3) 매도 진입
f) 만약 현재 바의 종가가 상향 추세선을 하향 돌파하고 이 추세선의 기울기가 10° 이상이면 다음 바의 시가에 매도 진입한다.
4) 청산
g) 최근 6개의 bars보다 low 값이 작으면 매수 포지션을 청산한다.
h) 최근 6개의 bars보다 high 값이 크면 매도 포지션을 청산한다.
Inputs: RHStren(4), RLStren(4), Trailbar(6);
Vars: RHTLRef(-1), RHTLRef2(-1), RHSet(-1), RHSet2(-1), RHArrayVal(0), RHColorVar(0), RLColorVar(0), BarsPast(0);
Vars: RLTLRef(-1), RLTLRef2(-1), RLSet(-1), RLSet2(-1),RLArrayVal(0), BuyPrice(0), PrevBuyPrice(0), SellPrice(0), PrevSellPrice(0);
Array: RHDate[10](0), RHTime[10](0), RHVal[10](0);
Array: RLDate[10](99999), RLTime[10](99999), RLVal[10](99999);
If SwingHighBar(1, High, RHStren, RHStren+1)=RHStren then begin
for Value1=9 downto 0 begin
RHDate[Value1+1]=RHDate[Value1];
RHTime[Value1+1]=RHTime[Value1];
RHVal[Value1+1]=RHVal[Value1];
end;
RHDate[0]=Date[RHStren];
RHTime[0]=Time[RHStren];
RHVal[0]=High[RHStren];
for Value22=1 to 10 begin
If RHVal[Value22]>RHVal[0] then begin
RHArrayVal=Value22;
Value22=11;
end;
End;
If Value22<>11 then begin
If RHSet>=0 then begin
RHSet2=TL_SetExtRight(RHTLRef, False);
TL_Delete(RHTLRef);
end;
RHTLRef=TL_New(RHDate[RHArrayVal], RHTime[RHArrayVal], RHVal[RHArrayVal], RHDate[0], RHTime[0], RHVal[0]);
RHSet=TL_SetExtRight(RHTLRef, True);
End;
End;
{ Find new Swing Low bars and draw corresponding trend lines }
If SwingLowBar(1, Low, RLStren, RLStren+1)=RLStren then begin
for Value1=9 downto 0 begin
RLDate[Value1+1]=RLDate[Value1];
RLTime[Value1+1]=RLTime[Value1];
RLVal[Value1+1]=RLVal[Value1];
end;
RLDate[0]=Date[RLStren];
RLTime[0]=Time[RLStren];
RLVal[0]=Low[RLStren];
for Value22=1 to 10 begin
If RLVal[Value22] RLArrayVal=Value22;
Value22=11;
end;
End;
If Value22<>11 then begin
If RLSet>=0 then begin
RLTLRef2=TL_SetEnd(RLTLRef, Date,Time,TL_GetValue(RLTLRef, date, time));
RLSet2=TL_SetExtRight(RLTLRef, False);
TL_Delete(RLTLRef);
end;
RLTLRef=TL_New(RLDate[RLArrayVal], RLTime[RLArrayVal], RLVal[RLArrayVal], RLDate[0], RLTime[0], RLVal[0]);
RLSet=TL_SetExtRight(RLTLRef, True);
End;
End;
{ Place orders to enter long positions }
If RHTLRef <> -1 then Begin
BuyPrice = TL_GetValue( RHTLRef , Date, Time );
PrevBuyPrice = TL_Getvalue( RHTLRef , Date[1] , Time[1] );
If Close Crosses Over BuyPrice AND Arctangent( PrevBuyPrice / BuyPrice)>10 then
Buy next bar at Market;
End;
{ Place orders to enter short positions }
If RLTLRef <> -1 then Begin
SellPrice = TL_GetValue( RLTLRef , Date , Time );
PrevSellPrice = TL_Getvalue( RLTLRef , Date[1] , Time[1] );
If Close crosses under SellPrice AND Arctangent(SellPrice / PrevSellPrice)>10 then
Sell next bar at Market;
End;
{ Trailing protective stop orders }
ExitLong next bar at Lowest( Low , TrailBar ) Stop;
ExitShort next bar at Highest( High , TrailBar ) Stop;
다음글
이전글