커뮤니티

수식 부탁드립니다.

프로필 이미지
회원
2010-08-23 10:26:30
652
글번호 31770
답변완료
아래와 같은 수식에 1. 강제청산 후에 다른방향 진입만되는 수식 2.목표수익청산 후 다른 반대방향 진입부터 시작하는 식 3. 강제청산후 같은신호 계속발생 제거식 4. 위의 1,2,3에서 각각 선물지수 1p 수익후에는 매매중단하는 식 위의 1,2,3,4를 제 수식에 포함하는 수식을 좀 작성해주세요~~ 게시판의 글을 보고 해봤는데...계속 오류입니다. 저의 수식 Input : Period(20), shortPeriod(5), longperiod(20), ; value1 = ma(C, shortPeriod); value2 = ma(C, longPeriod); # 매수/매도청산 If ma(c,period) >= ma(c[1],period) and c>=o Then { Buy(); } # 매도/매수청산 If ma(c,period) <= ma(c[1],period) and c<=o Then { Sell(); } 이상입니다. 부탁드립니다
시스템
답변 2
프로필 이미지

예스스탁 예스스탁 답변

2010-08-23 12:37:16

안녕하세요 예스스탁입니다. Input : Period(20), shortPeriod(5), longperiod(20); var : PLR(0),XCommission(0),XSlippage(0),OpenPL(0),dayPL(0),count(0); XCommission = ((C*ExitCommission)/100)*CurrentContracts; #%설정 XSlippage = (ExitSlippage)*CurrentContracts; #Pt설정 PLR = 0; count = 0; for var1 = 1 to 10{ if sdate == EntryDate(var1) Then{ count = count+1; PLR = PLR+PositionProfit(var1); } } if MarketPosition() == 0 Then{ OpenPL = 0; dayPL = PLR; } Else{ OpenPL = (PositionProfit-(XCommission+XSlippage)); dayPL = PLR+OpenPL; } value1 = ma(C, shortPeriod); value2 = ma(C, longPeriod); Condition1 = IsExitName("StopLoss",1) or IsExitName("StopProfittarget",1) or IsExitName("StopTrailing",1); if MarketPosition == 0 and Condition1 == true and daypl < 1 Then{ If MarketPosition(1) == -1 and ma(c,period) >= ma(c[1],period) and c>=o Then Buy(); If MarketPosition(1) == 1 and ma(c,period) <= ma(c[1],period) and c<=o Then Sell(); } if MarketPosition == 0 and Condition1 == False and daypl < 1 Then{ If ma(c,period) >= ma(c[1],period) and c>=o Then Buy(); If ma(c,period) <= ma(c[1],period) and c<=o Then Sell(); } if MarketPosition == -1 and daypl < 1 Then{ If ma(c,period) >= ma(c[1],period) and c>=o Then Buy(); } if MarketPosition == 1 and daypl < 1 Then{ If ma(c,period) <= ma(c[1],period) and c<=o Then Sell(); } if dayPL >= 1 Then{ exitlong(); ExitShort(); } 즐거운 하루되세요 > 산천초목 님이 쓴 글입니다. > 제목 : 수식 부탁드립니다. > 아래와 같은 수식에 1. 강제청산 후에 다른방향 진입만되는 수식 2.목표수익청산 후 다른 반대방향 진입부터 시작하는 식 3. 강제청산후 같은신호 계속발생 제거식 4. 위의 1,2,3에서 각각 선물지수 1p 수익후에는 매매중단하는 식 위의 1,2,3,4를 제 수식에 포함하는 수식을 좀 작성해주세요~~ 게시판의 글을 보고 해봤는데...계속 오류입니다. 저의 수식 Input : Period(20), shortPeriod(5), longperiod(20), ; value1 = ma(C, shortPeriod); value2 = ma(C, longPeriod); # 매수/매도청산 If ma(c,period) >= ma(c[1],period) and c>=o Then { Buy(); } # 매도/매수청산 If ma(c,period) <= ma(c[1],period) and c<=o Then { Sell(); } 이상입니다. 부탁드립니다
프로필 이미지

회원

2010-08-23 12:45:47

감사드립니다.^^