커뮤니티

수식전환 문의드립니다.

프로필 이미지
동방삭2
2009-03-29 12:06:07
910
글번호 21255
답변완료
시스템서적에 소개된 ts용 수식입니다. yt로 변환할려고 하는데 검증오류가나서 진행이 않되고 있습니다. yt랭귀지로 변환부탁드립니다. 감사합니다. Input: BandLen(10), NumBOvr(2), NumBUnd(2); Vars: HiBand(0), LoBand(0), Channel(0), MP(0), StopPrice(0); { Setup calculations } HiBand = BollingerBand(Close,10,2); LoBand = BollingerBand(Close,10,-2); Channel = HiBand - LoBand; { Short entries } If MRO( Close <= HiBand , NumBOvr , 1 ) = -1 AND MarketPosition <> -1 then Sell next bar at Open; If MarketPosition = -1 then Sell ("SLim") at HiBand Limit; { Long entries } If MRO( Close >= LoBand, NumBUnd , 1 ) = -1 AND MarketPosition <> 1 then Buy next bar at Open; If MarketPosition = 1 then Buy ("BLim") at LoBand Limit; { Long and short trailing stop } MP = MarketPosition; If MP = 1 and MP[1] <> 1 then StopPrice = Low - Average(Range,4); If MP = -1 and MP[1] <> -1 then StopPrice = High + Average(Range,4); If MP = 1 then begin Exitlong next bar at StopPrice Stop; StopPrice = StopPrice + (Low - StopPrice)/3; End; If MP = -1 then Begin Exitshort next bar at StopPrice Stop; StopPrice = StopPrice - (StopPrice - High)/3; End;
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2009-03-30 10:04:18

안녕하세요 예스스탁입니다. Input: BandLen(10), NumBOvr(2), NumBUnd(2); Vars: HiBand(0), LoBand(0), Channel(0), MP(0), StopPrice(0); //{ Setup calculations } HiBand = BollBandUp(10,2); LoBand = BollBandDown(10,2); Channel = HiBand - LoBand; //{ Short entries } If MRO(Close <= HiBand , NumBOvr , 1 ) == -1 AND MarketPosition <> -1 then Sell("s",AtMarket); If MarketPosition == -1 then Sell("SLim",AtLimit,HiBand); //{ Long entries } If MRO( Close >= LoBand, NumBUnd , 1 ) == -1 AND MarketPosition <> 1 then Buy("b",AtMarket); If MarketPosition == 1 then Buy("BLim",AtLimit, LoBand); //{ Long and short trailing stop } MP = MarketPosition; If MP == 1 and MP[1] <> 1 then StopPrice = Low - Average(Range,4); If MP == -1 and MP[1] <> -1 then StopPrice = High + Average(Range,4); If MP == 1 then begin Exitlong("EL", AtStop, StopPrice); StopPrice = StopPrice + (Low - StopPrice)/3; End; If MP == -1 then Begin Exitshort("ES",AtStop, StopPrice); StopPrice = StopPrice - (StopPrice - High)/3; End; 즐거운 하루되세요 > 동방삭2 님이 쓴 글입니다. > 제목 : 수식전환 문의드립니다. > 시스템서적에 소개된 ts용 수식입니다. yt로 변환할려고 하는데 검증오류가나서 진행이 않되고 있습니다. yt랭귀지로 변환부탁드립니다. 감사합니다. Input: BandLen(10), NumBOvr(2), NumBUnd(2); Vars: HiBand(0), LoBand(0), Channel(0), MP(0), StopPrice(0); { Setup calculations } HiBand = BollingerBand(Close,10,2); LoBand = BollingerBand(Close,10,-2); Channel = HiBand - LoBand; { Short entries } If MRO( Close <= HiBand , NumBOvr , 1 ) = -1 AND MarketPosition <> -1 then Sell next bar at Open; If MarketPosition = -1 then Sell ("SLim") at HiBand Limit; { Long entries } If MRO( Close >= LoBand, NumBUnd , 1 ) = -1 AND MarketPosition <> 1 then Buy next bar at Open; If MarketPosition = 1 then Buy ("BLim") at LoBand Limit; { Long and short trailing stop } MP = MarketPosition; If MP = 1 and MP[1] <> 1 then StopPrice = Low - Average(Range,4); If MP = -1 and MP[1] <> -1 then StopPrice = High + Average(Range,4); If MP = 1 then begin Exitlong next bar at StopPrice Stop; StopPrice = StopPrice + (Low - StopPrice)/3; End; If MP = -1 then Begin Exitshort next bar at StopPrice Stop; StopPrice = StopPrice - (StopPrice - High)/3; End;