커뮤니티
문의 드립니다.
2010-05-17 00:44:59
779
글번호 29949
안녕하세요. 아래식은 인베스트라 예제인데 TY로 변환 가능한지요? 부탁 드리겠습니다.
Input: FastLen(9), SlowLen(18), ChLen(12), TrailBar(8), Initial(300), ReBars(15), Reentry(100);
Vars: FastMA(0), SlowMA(0), LEntryPrice(0), SEntryPrice(0), LCount(-999), SCount(-999),
ReEntryCount(0), CurrentPosition(0);
FastMA = Average( Close , FastLen );
SlowMA = Average( Close , SlowLen );
{ Order Placement for Long Positions }
If FastMA crosses over SlowMA and barnumber > 1 then Begin
LEntryPrice = Highest( High , TrailBar )[1] * 1.02;
LCount = BarNumber;
End;
commentary( barnumber - lcount , lentryprice );
If MarketPosition <> 1 AND BarNumber < LCount + ChLen then
Buy ("Cross Over Buy") Initial Shares next bar at LEntryPrice Stop;
{ Order Placement for Short Positions }
If FastMA crosses under SlowMA and barnumber > 1 then Begin
SEntryPrice = Lowest( Low , TrailBar )[1] *.98;
SCount = BarNumber;
End;
If MarketPosition <> -1 AND BarNumber < SCount + ChLen then
Sell ("Cross Under Buy") Initial Shares next bar at SEntryPrice Stop;
{ Trailing Stop while in Position }
If MarketPosition = 1 then begin
LCount = -999;
ExitLong ("LongTStop") next bar at Lowest( Low , TrailBar ) Stop;
End;
If MarketPosition = -1 then Begin
SCount = -999;
ExitShort ("ShortTStop") next bar at Highest( High , TrailBar ) stop;
End;
{ Reentry Technique }
CurrentPosition = MarketPosition;
If CurrentPosition = 0 AND CurrentPosition[1] = -1 then
ReEntryCount = 1;
If CurrentPosition = 0 AND CurrentPosition[1] = 1 then
ReEntryCount = 1;
If MarketPosition = 0 AND MarketPosition(1) = 1 AND ReEntryCount < ReBars then Begin
ReEntryCount = ReEntryCount + 1;
Buy ("Long ReEntry") ReEntry Shares next bar at Highest( High , 10 ) Stop;
End;
If MarketPosition = 0 AND MarketPosition(1) = -1 AND ReEntryCount < ReBars then Begin
ReEntryCount = ReEntryCount + 1;
Sell ("Short ReEntry") ReEntry Shares next bar at Lowest( Low , 10 ) Stop;
End;
감사합니다.
답변 1
예스스탁 예스스탁 답변
2010-05-17 10:35:29
안녕하세요
예스스탁입니다.
Input: FastLen(9), SlowLen(18), ChLen(12), TrailBar(8), Initial(300), ReBars(15), Reentry(100);
Vars: FastMA(0), SlowMA(0), LEntryPrice(0), SEntryPrice(0), LCount(-999), SCount(-999),
ReEntryCount(0), CurrentPosition(0);
FastMA = Average( Close , FastLen );
SlowMA = Average( Close , SlowLen );
#{ Order Placement for Long Positions }
If crossup(FastMA ,SlowMA) and index > 1 then Begin
LEntryPrice = Highest( High , TrailBar )[1] * 1.02;
LCount = index;
End;
#commentary( barnumber - lcount , lentryprice );
If MarketPosition <> 1 AND index < LCount + ChLen then
Buy("Cross Over Buy",AtStop,LEntryPrice);
#{ Order Placement for Short Positions }
If CrossDown(FastMA,SlowMA) and index > 1 then Begin
SEntryPrice = Lowest( Low , TrailBar )[1] *.98;
SCount = index;
End;
If MarketPosition <> -1 AND index < SCount + ChLen then
Sell ("Cross Under Buy",AtStop,SEntryPrice);
#{ Trailing Stop while in Position }
If MarketPosition == 1 then begin
LCount = -999;
ExitLong ("LongTStop",AtStop,Lowest( Low , TrailBar ));
End;
If MarketPosition == -1 then Begin
SCount = -999;
ExitShort ("ShortTStop",AtStop,Highest( High , TrailBar ));
End;
#{ Reentry Technique }
CurrentPosition = MarketPosition;
If CurrentPosition == 0 AND CurrentPosition[1] == -1 then
ReEntryCount = 1;
If CurrentPosition == 0 AND CurrentPosition[1] == 1 then
ReEntryCount = 1;
If MarketPosition == 0 AND MarketPosition(1) == 1 AND ReEntryCount < ReBars then Begin
ReEntryCount = ReEntryCount + 1;
Buy ("Long ReEntry",AtStop,Highest( High , 10 ));
End;
If MarketPosition == 0 AND MarketPosition(1) == -1 AND ReEntryCount < ReBars then Begin
ReEntryCount = ReEntryCount + 1;
Sell ("Short ReEntry",AtStop,Lowest( Low , 10 ));
End;
즐거운 하루되세요
> HI_coco 님이 쓴 글입니다.
> 제목 : 문의 드립니다.
> 안녕하세요. 아래식은 인베스트라 예제인데 TY로 변환 가능한지요? 부탁 드리겠습니다.
Input: FastLen(9), SlowLen(18), ChLen(12), TrailBar(8), Initial(300), ReBars(15), Reentry(100);
Vars: FastMA(0), SlowMA(0), LEntryPrice(0), SEntryPrice(0), LCount(-999), SCount(-999),
ReEntryCount(0), CurrentPosition(0);
FastMA = Average( Close , FastLen );
SlowMA = Average( Close , SlowLen );
{ Order Placement for Long Positions }
If FastMA crosses over SlowMA and barnumber > 1 then Begin
LEntryPrice = Highest( High , TrailBar )[1] * 1.02;
LCount = BarNumber;
End;
commentary( barnumber - lcount , lentryprice );
If MarketPosition <> 1 AND BarNumber < LCount + ChLen then
Buy ("Cross Over Buy") Initial Shares next bar at LEntryPrice Stop;
{ Order Placement for Short Positions }
If FastMA crosses under SlowMA and barnumber > 1 then Begin
SEntryPrice = Lowest( Low , TrailBar )[1] *.98;
SCount = BarNumber;
End;
If MarketPosition <> -1 AND BarNumber < SCount + ChLen then
Sell ("Cross Under Buy") Initial Shares next bar at SEntryPrice Stop;
{ Trailing Stop while in Position }
If MarketPosition = 1 then begin
LCount = -999;
ExitLong ("LongTStop") next bar at Lowest( Low , TrailBar ) Stop;
End;
If MarketPosition = -1 then Begin
SCount = -999;
ExitShort ("ShortTStop") next bar at Highest( High , TrailBar ) stop;
End;
{ Reentry Technique }
CurrentPosition = MarketPosition;
If CurrentPosition = 0 AND CurrentPosition[1] = -1 then
ReEntryCount = 1;
If CurrentPosition = 0 AND CurrentPosition[1] = 1 then
ReEntryCount = 1;
If MarketPosition = 0 AND MarketPosition(1) = 1 AND ReEntryCount < ReBars then Begin
ReEntryCount = ReEntryCount + 1;
Buy ("Long ReEntry") ReEntry Shares next bar at Highest( High , 10 ) Stop;
End;
If MarketPosition = 0 AND MarketPosition(1) = -1 AND ReEntryCount < ReBars then Begin
ReEntryCount = ReEntryCount + 1;
Sell ("Short ReEntry") ReEntry Shares next bar at Lowest( Low , 10 ) Stop;
End;
감사합니다.
다음글
이전글