커뮤니티

질문드립니다

프로필 이미지
프리
2013-08-13 11:46:24
166
글번호 66396
답변완료
안녕하세요 예스스탁입니다. 아래식 참고하시기 바랍니다. 당일이익, 당일손실 모두 제어하는 식입니다. 수수료와 슬리피지를 반영하지 않고자 하시면 시스템 트레이딩 설정창의 거래/비용탭에서 수수료와 슬리피지를 모두 0으로 셋팅하시면 됩니다. --만약이수식을 스톡케스틱에서 적용해보니까요 매거래마다 청산이 발생합니다 조건이 만족하면 청산되는것이 아니구요 확인을 좀 부탁합니다. 저는 총누적손실이 1포이거나 총누적순익이 1포가 되면 무조건 청산하라 더이상 거래를 발생시키지말라고 수식을 만들고 싶습니다. input:하루이익(1),하루손실(-1); var : NP(0),PreNP(0),dayPL(0),count(0); NP = NetProfit; if date != date[1] Then preNP = BP[1]; #당일손익(최근 청산 완료된 거래까지의 손익) dayPL = NP-PreNP; if daypl < 하루이익 and dayPL > -하루손실 then{ if crossup(c,ma(c,20)) Then buy(); if CrossDown(c,ma(c,20)) Then Sell(); } if MarketPosition == 1 and CrossDown(c,ma(c,20)) Then ExitLong(); if MarketPosition == -1 and crossup(c,ma(c,20)) Then ExitShort(); if MarketPosition == 1 Then{ ExitLong("bx1",AtStop,EntryPrice+(하루손실-dayPL)); ExitLong("bx2",AtLimit,EntryPrice+(하루이익-dayPL)); } if MarketPosition == -1 Then{ ExitShort("sx1",AtStop,EntryPrice-(하루손실-dayPL)); ExitShort("sx2",AtLimit,EntryPrice-(하루이익-dayPL)); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2013-08-13 13:25:01

안녕하세요 예스스탁입니다. 첨부된 그림은 진입을 MACD Oscillator로 변경해 서 적용한 식의 리포트 입니다. 일간 손익이 모두 1이나 -1까지만 발생하는 것을 보실수 있습니다. 설정창의 수수료와 슬리피지는 모두 0으로 셋팅된 상태입니다. input:하루이익(1),하루손실(-1); Input : shortPeriod(12), longPeriod(26), Period(9); var : NP(0),PreNP(0),dayPL(0),count(0); value1 = MACD(shortPeriod, longPeriod); value2 = ema(value1, Period); NP = NetProfit; if date != date[1] Then preNP = NP[1]; #당일손익(최근 청산 완료된 거래까지의 손익) dayPL = NP-PreNP; if daypl < 하루이익 and dayPL > 하루손실 then{ if crossup(value1,value2) Then buy(); if CrossDown(value1,value2) Then Sell(); } #아래부터는 당일 누적 수익과 손실 청산 부분 #진입봉 바로 다음봉에서도 청산이 되게 추가했습니다. if MarketPosition == 1 Then{ ExitLong("bx1",AtStop,EntryPrice+(하루손실-dayPL)); ExitLong("bx2",AtLimit,EntryPrice+(하루이익-dayPL)); } if MarketPosition != 1 Then{ ExitLong("bx11",AtStop,C+(하루손실-dayPL)); ExitLong("bx22",AtLimit,C+(하루이익-dayPL)); } if MarketPosition == -1 Then{ ExitShort("sx1",AtStop,EntryPrice-(하루손실-dayPL)); ExitShort("sx2",AtLimit,EntryPrice-(하루이익-dayPL)); } if MarketPosition != -1 Then{ ExitShort("sx11",AtStop,c-(하루손실-dayPL)); ExitShort("sx22",AtLimit,c-(하루이익-dayPL)); } 즐거운 하루되세요 > 프리 님이 쓴 글입니다. > 제목 : 질문드립니다 > 안녕하세요 예스스탁입니다. 아래식 참고하시기 바랍니다. 당일이익, 당일손실 모두 제어하는 식입니다. 수수료와 슬리피지를 반영하지 않고자 하시면 시스템 트레이딩 설정창의 거래/비용탭에서 수수료와 슬리피지를 모두 0으로 셋팅하시면 됩니다. --만약이수식을 스톡케스틱에서 적용해보니까요 매거래마다 청산이 발생합니다 조건이 만족하면 청산되는것이 아니구요 확인을 좀 부탁합니다. 저는 총누적손실이 1포이거나 총누적순익이 1포가 되면 무조건 청산하라 더이상 거래를 발생시키지말라고 수식을 만들고 싶습니다. input:하루이익(1),하루손실(-1); var : NP(0),PreNP(0),dayPL(0),count(0); NP = NetProfit; if date != date[1] Then preNP = BP[1]; #당일손익(최근 청산 완료된 거래까지의 손익) dayPL = NP-PreNP; if daypl < 하루이익 and dayPL > -하루손실 then{ if crossup(c,ma(c,20)) Then buy(); if CrossDown(c,ma(c,20)) Then Sell(); } if MarketPosition == 1 and CrossDown(c,ma(c,20)) Then ExitLong(); if MarketPosition == -1 and crossup(c,ma(c,20)) Then ExitShort(); if MarketPosition == 1 Then{ ExitLong("bx1",AtStop,EntryPrice+(하루손실-dayPL)); ExitLong("bx2",AtLimit,EntryPrice+(하루이익-dayPL)); } if MarketPosition == -1 Then{ ExitShort("sx1",AtStop,EntryPrice-(하루손실-dayPL)); ExitShort("sx2",AtLimit,EntryPrice-(하루이익-dayPL)); }