커뮤니티

수식 좀 부탁 드립니다.(목표수익)

프로필 이미지
요타
2020-09-21 23:41:03
888
글번호 142524
답변완료
* 많은 도움에 고맙 습니다. * <요청1> 04시 부터 다음날 08시 까지는 보유 및 진임금지 수식 좀 요청 드립니다. 즉 새벽 04시 되면 모든 계약 을 청산(매수진입, 매도진입 모두 청산) 하고 아침 08시 까지 대기후 08시1분 되면 조건에 맞게 매매시작 하는 로직 좀 부탁 드립니다. * <요청2> 다음 수식에서 어느 부분이 잘못했는지 지도 좀 요청 드림니다. ## 30봉 경과후 수익이 "0" 이면 청산 if MarketPosition == 1 and IsEntryName("SS1") == true and BarsSinceEntry >= 30 Then {if highest(H,BarsSinceEntry) > EntryPrice+PriceScale Then ExitLong ("SSSWDD3");} if MarketPosition == -1 and IsEntryName("DD1") == true and BarsSinceEntry >= 30 Then {if Lowest(L,BarsSinceEntry) < EntryPrice-PriceScale Then ExitShort("DDSWSS3");} 어느 부분이 잘못 되었는지 청산이 안됨니다. * <요청3> 즉 아래 세개 수식을 하나로 합처 주시면 고맙겠습니다. 아래 수식으로 매수후 var1 = ma(c,5) ; var2 = ma(c,10) ; var3 = ma(c,20) ; if crossup(var1,var2) then buy("aa1") ; if crossdowwn(var1,var2) then sell("bb1") ; 1차 목표 수익후 바로 청산 하는것이 아니라 1차 목표 수익 달성후 2차 목표 수익 까지 대기 2차 목표 수익 달성 아니면 1차 목표 수익 달성후 1차 목표 수익이 줄어들어 청산로직 까지 오면 청산 요청 드립니다. 즉 아래 세개 수식을 하나로 합처 주시면 고맙겠습니다. 아래 기준 수식) .1차 목표 수익 달성(70틱) .2차 목표 수익 달성(100틱) .1차 목표 수익 달성후 손실 발생 하면 최종 40틱 까지 오면 청산 입니다. ## 1차 목표 수익 청산 if MarketPosition == 1 Then { if highest(H,BarsSinceEntry) > EntryPrice+PriceScale*70 Then ExitLong("수청1",AtLimit,EntryPrice+PriceScale*60);} if MarketPosition == -1 Then { if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*70 Then ExitShort("도청1",AtLimit,EntryPrice-PriceScale*60);} ## 2차 목표 수익 청산 if MarketPosition == 1 Then { if highest(H,BarsSinceEntry) > EntryPrice+PriceScale*100 Then ExitLong("수청1",AtLimit,EntryPrice+PriceScale*80);} if MarketPosition == -1 Then { if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*100 Then ExitShort("도청1",AtLimit,EntryPrice-PriceScale*80);} ## 1차 목표 수익후 아래 수익까지 줄어들면 최종 청산 if MarketPosition == 1 and IsEntryName("SS1") == true Then {if highest(H,BarsSinceEntry) > EntryPrice+PriceScale*60 Then ExitLong ("수청3",AtStop,EntryPrice+PriceScale*40);} if MarketPosition == -1 and IsEntryName("DD1") == true Then {if Lowest(L,BarsSinceEntry) < EntryPrice-PriceScale*60 Then ExitShort("도청3",AtStop,EntryPrice-PriceScale*40);} * 많은 지도에 고맙습니다. 수고하십시요.
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-09-23 11:31:03

안녕하세요 예스스탁입니다. 1 input : EndTime(040000); var : Tcond(false); if sDate != sDate[1] Then SetStopEndofday(EndTime); if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if Bdate != Bdate[1] Then { Tcond = true; SetStopEndofday(0); } if Tcond == true Then { 진입청산수식 } 2 해당 수식은 진입이후 30봉 경과 후에 진입이후 1틱이상 수익이 발생한적이 없으면 청산하는 식입니다. 진입이후 30봉 경과후 해당봉에서 수익이 0이하이면 청산하고자 하시면 아래식 이용하시면 됩니다. if MarketPosition == 1 and IsEntryName("SS1") == true and BarsSinceEntry >= 30 Then { if c <= EntryPrice Then ExitLong ("SSSWDD3"); } if MarketPosition == -1 and IsEntryName("DD1") == true and BarsSinceEntry >= 30 Then { if C >= EntryPrice Then ExitShort("DDSWSS3"); } 3 var1 = ma(c,5) ; var2 = ma(c,10) ; var3 = ma(c,20) ; if crossup(var1,var2) then buy("aa1") ; if crossdown(var1,var2) then sell("bb1") ; ## 1차 목표 수익 청산 if MarketPosition == 1 Then { ExitLong("수청1",AtLimit,EntryPrice+PriceScale*100); if highest(H,BarsSinceEntry) > EntryPrice+PriceScale*70 Then ExitLong("수청2",AtStop,EntryPrice+PriceScale*40); } if MarketPosition == -1 Then { ExitShort("도청1",AtLimit,EntryPrice-PriceScale*100); if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*70 Then ExitShort("도청2",AtStop,EntryPrice-PriceScale*40); } 즐거운 하루되세요 > 요타 님이 쓴 글입니다. > 제목 : 수식 좀 부탁 드립니다.(목표수익) > * 많은 도움에 고맙 습니다. * <요청1> 04시 부터 다음날 08시 까지는 보유 및 진임금지 수식 좀 요청 드립니다. 즉 새벽 04시 되면 모든 계약 을 청산(매수진입, 매도진입 모두 청산) 하고 아침 08시 까지 대기후 08시1분 되면 조건에 맞게 매매시작 하는 로직 좀 부탁 드립니다. * <요청2> 다음 수식에서 어느 부분이 잘못했는지 지도 좀 요청 드림니다. ## 30봉 경과후 수익이 "0" 이면 청산 if MarketPosition == 1 and IsEntryName("SS1") == true and BarsSinceEntry >= 30 Then {if highest(H,BarsSinceEntry) > EntryPrice+PriceScale Then ExitLong ("SSSWDD3");} if MarketPosition == -1 and IsEntryName("DD1") == true and BarsSinceEntry >= 30 Then {if Lowest(L,BarsSinceEntry) < EntryPrice-PriceScale Then ExitShort("DDSWSS3");} 어느 부분이 잘못 되었는지 청산이 안됨니다. * <요청3> 즉 아래 세개 수식을 하나로 합처 주시면 고맙겠습니다. 아래 수식으로 매수후 var1 = ma(c,5) ; var2 = ma(c,10) ; var3 = ma(c,20) ; if crossup(var1,var2) then buy("aa1") ; if crossdowwn(var1,var2) then sell("bb1") ; 1차 목표 수익후 바로 청산 하는것이 아니라 1차 목표 수익 달성후 2차 목표 수익 까지 대기 2차 목표 수익 달성 아니면 1차 목표 수익 달성후 1차 목표 수익이 줄어들어 청산로직 까지 오면 청산 요청 드립니다. 즉 아래 세개 수식을 하나로 합처 주시면 고맙겠습니다. 아래 기준 수식) .1차 목표 수익 달성(70틱) .2차 목표 수익 달성(100틱) .1차 목표 수익 달성후 손실 발생 하면 최종 40틱 까지 오면 청산 입니다. ## 1차 목표 수익 청산 if MarketPosition == 1 Then { if highest(H,BarsSinceEntry) > EntryPrice+PriceScale*70 Then ExitLong("수청1",AtLimit,EntryPrice+PriceScale*60);} if MarketPosition == -1 Then { if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*70 Then ExitShort("도청1",AtLimit,EntryPrice-PriceScale*60);} ## 2차 목표 수익 청산 if MarketPosition == 1 Then { if highest(H,BarsSinceEntry) > EntryPrice+PriceScale*100 Then ExitLong("수청1",AtLimit,EntryPrice+PriceScale*80);} if MarketPosition == -1 Then { if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*100 Then ExitShort("도청1",AtLimit,EntryPrice-PriceScale*80);} ## 1차 목표 수익후 아래 수익까지 줄어들면 최종 청산 if MarketPosition == 1 and IsEntryName("SS1") == true Then {if highest(H,BarsSinceEntry) > EntryPrice+PriceScale*60 Then ExitLong ("수청3",AtStop,EntryPrice+PriceScale*40);} if MarketPosition == -1 and IsEntryName("DD1") == true Then {if Lowest(L,BarsSinceEntry) < EntryPrice-PriceScale*60 Then ExitShort("도청3",AtStop,EntryPrice-PriceScale*40);} * 많은 지도에 고맙습니다. 수고하십시요.