커뮤니티

Mov Avg Crossover시스템식 문의

프로필 이미지
공감n감사
2011-05-03 13:42:40
624
글번호 38250
답변완료
안녕하세요. Q&A에서 많은 도움을 얻고 있는 일인입니다^^. 항상 감사합니다. GAMBLER님이 소개해 주신 "Mov Avg Crossover"의 수식중에 이해안되는 부분이 있어서 문의드립니다. ------------------------------------------------------------------------------ Input: FastLen(10), SlowLen(500), ChLen(30), TrailBar(160), ReBars(2), stopPer(1.0); Vars: FastMA(0), SlowMA(0),LEntryPrice(0), SEntryPrice(0), LCount(-999), SCount(-999), ReCnt(0), MP(0); FastMA = ma(C , FastLen ); SlowMA = ma(C , SlowLen ); If CrossUp(FastMA , SlowMA) and index > 1 then { LEntryPrice = Highest(H , TrailBar )[1]; LCount = index; } If MarketPosition <> 1 AND index < LCount + ChLen then Buy ("Cross Over Buy", atstop,LEntryPrice); If CrossDown(FastMA , SlowMA) and index > 1 then { SEntryPrice = Lowest(L , TrailBar )[1]; SCount = index; } If MarketPosition <> -1 AND index < SCount + ChLen then Sell ("Cross Under Sell", atstop,SEntryPrice ); If MarketPosition == 1 then { LCount = -999; ExitLong ("LongTStop", atstop, Lowest(L , TrailBar )); } If MarketPosition == -1 then { SCount = -999; ExitShort ("ShortTStop", atstop, Highest(H , TrailBar )); } // 재진입 /*MP = MarketPosition; If MP == 0 AND MP[1] == -1 then ReCnt = 1; If MP == 0 AND MP[1] == 1 then ReCnt = 1; If MarketPosition == 0 AND MarketPosition(1) == 1 AND ReCnt < ReBars then { ReCnt = ReCnt + 1; Buy ("Long ReEntry", atstop,Highest(H , TrailBar ) ) ; } If MarketPosition == 0 AND MarketPosition(1) == -1 AND ReCnt < ReBars then { ReCnt = ReCnt + 1; Sell ("Short ReEntry", atstop,Lowest(L , TrailBar ) ) ; }*/ SetStopLoss(stopPer, PercentStop); SetStopEndofday(150000); --------------------------------------------------------------------------------- 첫번째 질문은, 위의 수식중에서 아래 이 두가지가 하는 역할이 뭔지 궁금합니다. LCount = -999; SCount = -999; 두번째 질문은, 재진입식에 2번 재진입후 3번째부터는 재진입을 금지하는 식을 알고싶습니다. 세번째는, setstoploss와 setStopProfitTarget를 조건에 맞추어 몇가지로 하고 싶은데, exitlong,exitshort과 atstop을 이용해서 만들려면 어떻게 해야 하나요? 미리 감사드립니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2011-05-03 16:09:22

안녕하세요 예스스탁입니다. 1. Lcount와 Scount는 이동평균 골든이나 데드가 발생하면 index를 저장하고 이 위치에서30개봉안에 신호가 발생합니다. 진입하고 나서 Lcount와 Scount에 -999같은 작은 값을 주어 진입하고 나면 다음 진입은 새로운 골드데드가 발생하고 들어가기 위해서 작성된 내용입니다. 즉 진입하면 index < LCount + ChLen를 만족하지 못하는 조건식으로 만들기 위해 임의의 작은수를 준 것입니다. 2. Input: FastLen(10), SlowLen(500), ChLen(30), TrailBar(160), ReBars(2), stopPer(1.0); Vars: FastMA(0), SlowMA(0),LEntryPrice(0), SEntryPrice(0), LCount(-999), SCount(-999), ReCnt(0), MP(0); FastMA = ma(C , FastLen ); SlowMA = ma(C , SlowLen ); If CrossUp(FastMA , SlowMA) and index > 1 then { LEntryPrice = Highest(H , TrailBar )[1]; LCount = index; } If MarketPosition <> 1 AND index < LCount + ChLen then Buy ("Cross Over Buy", atstop,LEntryPrice); If CrossDown(FastMA , SlowMA) and index > 1 then { SEntryPrice = Lowest(L , TrailBar )[1]; SCount = index; } If MarketPosition <> -1 AND index < SCount + ChLen then Sell ("Cross Under Sell", atstop,SEntryPrice ); If MarketPosition == 1 then { LCount = -999; ExitLong ("LongTStop", atstop, Lowest(L , TrailBar )); } If MarketPosition == -1 then { SCount = -999; ExitShort ("ShortTStop", atstop, Highest(H , TrailBar )); } // 재진입 MP = MarketPosition; If MP == 0 AND MP[1] == -1 then ReCnt = 1; If MP == 0 AND MP[1] == 1 then ReCnt = 1; Condition1 = MarketPosition(1) == 1 and MarketPosition(2) == 1 and ExitDate(2) ==sdate; Condition2 = MarketPosition(1) == -1 and MarketPosition(2) == -1 and ExitDate(2) ==sdate; If MarketPosition == 0 AND MarketPosition(1) == 1 AND ReCnt < ReBars And Condition1 == false then { ReCnt = ReCnt + 1; Buy ("Long ReEntry", atstop,Highest(H , TrailBar ) ) ; } If MarketPosition == 0 AND MarketPosition(1) == -1 AND ReCnt < ReBars and Condition1 == false then { ReCnt = ReCnt + 1; Sell ("Short ReEntry", atstop,Lowest(L , TrailBar ) ) ; } SetStopLoss(stopPer, PercentStop); SetStopEndofday(150000); 3. 목표이익과 손절매를 수식으로 풀어작성한 식입니다. if MarketPosition == 1 Then{ ExitLong("BLoss",AtStop,EntryPrice-1); ExitLong("BProfit",AtLimit,EntryPrice+1); } if MarketPosition == -1 Then{ ExitShort("SLoss",AtStop,EntryPrice+1); ExitShort("SProfit",atlimit,EntryPrice-1); } 여러가지로 설정하시면 다면 위식을 참고하셔서 if뮨울 주어 여러개의 청산식을 만드시면 됩니다. 즐거운 하루되세요 > 공감n감사 님이 쓴 글입니다. > 제목 : Mov Avg Crossover시스템식 문의 > 안녕하세요. Q&A에서 많은 도움을 얻고 있는 일인입니다^^. 항상 감사합니다. GAMBLER님이 소개해 주신 "Mov Avg Crossover"의 수식중에 이해안되는 부분이 있어서 문의드립니다. ------------------------------------------------------------------------------ Input: FastLen(10), SlowLen(500), ChLen(30), TrailBar(160), ReBars(2), stopPer(1.0); Vars: FastMA(0), SlowMA(0),LEntryPrice(0), SEntryPrice(0), LCount(-999), SCount(-999), ReCnt(0), MP(0); FastMA = ma(C , FastLen ); SlowMA = ma(C , SlowLen ); If CrossUp(FastMA , SlowMA) and index > 1 then { LEntryPrice = Highest(H , TrailBar )[1]; LCount = index; } If MarketPosition <> 1 AND index < LCount + ChLen then Buy ("Cross Over Buy", atstop,LEntryPrice); If CrossDown(FastMA , SlowMA) and index > 1 then { SEntryPrice = Lowest(L , TrailBar )[1]; SCount = index; } If MarketPosition <> -1 AND index < SCount + ChLen then Sell ("Cross Under Sell", atstop,SEntryPrice ); If MarketPosition == 1 then { LCount = -999; ExitLong ("LongTStop", atstop, Lowest(L , TrailBar )); } If MarketPosition == -1 then { SCount = -999; ExitShort ("ShortTStop", atstop, Highest(H , TrailBar )); } // 재진입 /*MP = MarketPosition; If MP == 0 AND MP[1] == -1 then ReCnt = 1; If MP == 0 AND MP[1] == 1 then ReCnt = 1; If MarketPosition == 0 AND MarketPosition(1) == 1 AND ReCnt < ReBars then { ReCnt = ReCnt + 1; Buy ("Long ReEntry", atstop,Highest(H , TrailBar ) ) ; } If MarketPosition == 0 AND MarketPosition(1) == -1 AND ReCnt < ReBars then { ReCnt = ReCnt + 1; Sell ("Short ReEntry", atstop,Lowest(L , TrailBar ) ) ; }*/ SetStopLoss(stopPer, PercentStop); SetStopEndofday(150000); --------------------------------------------------------------------------------- 첫번째 질문은, 위의 수식중에서 아래 이 두가지가 하는 역할이 뭔지 궁금합니다. LCount = -999; SCount = -999; 두번째 질문은, 재진입식에 2번 재진입후 3번째부터는 재진입을 금지하는 식을 알고싶습니다. 세번째는, setstoploss와 setStopProfitTarget를 조건에 맞추어 몇가지로 하고 싶은데, exitlong,exitshort과 atstop을 이용해서 만들려면 어떻게 해야 하나요? 미리 감사드립니다.