커뮤니티

문의드립니다..

프로필 이미지
머니사이언스
2013-10-19 08:00:11
201
글번호 68621
답변완료
아래식이 트레이드스테이션용 인거 같은데 예스트레이더에는 작동이 안돼서요.. 언어가 틀려서 그런건 가요? 제가 실력이 부족해서요.. 작동 가능하도록 변환 부탁드립니다 ===================================================== 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
프로필 이미지

예스스탁 예스스탁 답변

2013-10-21 15:19:08

안녕하세요 예스스탁입니다. 해당식은 트레이드스테이션 수식입니다. 아래는 저희랭귀지로 변경한 식입니다. 진입이 특정값 +-2%라 선물에서는 신호를 보기 어렵습니다. 옵션이나 주식종목에 적용해 보시거나 %(per)조절해 보시기 바랍니다. Input: per(2),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+per/100); LCount = index; End; 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] *(1-per/100); 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; 즐거운 하루되세요 > 머니사이언스 님이 쓴 글입니다. > 제목 : 문의드립니다.. > 아래식이 트레이드스테이션용 인거 같은데 예스트레이더에는 작동이 안돼서요.. 언어가 틀려서 그런건 가요? 제가 실력이 부족해서요.. 작동 가능하도록 변환 부탁드립니다 ===================================================== 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;