커뮤니티

수식이 요청사항과 달라 다시 요청드립니다.^^

프로필 이미지
라떼처럼
2018-05-28 21:20:35
131
글번호 119279
답변완료

첨부 이미지

수식이 요청사항과 달라 다시 요청드립니다. 1계약이며, 거래시간 동안 이전 매수, 매도 진입 값을 기억하고 두번째 진입시 조건 만족시 매수 매도 진입하는 것입니다. 그림 참조 부탁드립니다. 거래시간 동안 1. Crossup(mav2,nmav3) ⓐ첫번째 매수진입값 --> 청산 또는 Crossdown(mav2,nmav3)에 의한 전환. ⓑ두번째 Crossup(mav2,nmav3) 매수진입은 ⓐ첫번째 매수진입값과 ±50 차이가 날때만 매수 진입 -->청산 또는 Crossdown(mav2,nmav3)에 의한 전환 ⓒ세번째 진입은 ⓑ두번째 매수진입값 참조, ⓓ네번째 진입은 ⓒ세번째 매수 진입값 참조....,... "Buy"에만 해당되며 "reBuy"는 상기 조건에 해당되지 않습니다 매도 쪽도 같은식으로 추가 부탁드립디다 input : P1(3),P2(10),P3(180); var : mav2(0),mav3(0); input : 익절1(100),익절1하락(50),손절(80); var : BH(0),SL(0),HE(0),LE(0); input : 시작시간(1016000), 종료시간(004000); var : Tcond(False); #ATR Input : ATR추적(20), ATR손절(20); # Var : PosHigh(0), PosLow(0); var : Bprice(0), Sprice(0); mav2 = ma(c,P2); mav3 = ma(c,P3); if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{ Tcond = true; Bprice = 0; Sprice = 0; } if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{ Tcond = false; } if TotalTrades > TotalTrades[1] and MarketPosition == 1 Then{ Bprice = EntryPrice(1); } if TotalTrades > TotalTrades[1] and MarketPosition == -1 Then{ Sprice = EntryPrice(1); } // if Tcond == true Then{ if crossup(mav2,mav3) Then { if Bprice == 0 or (Bprice > 0 and abs(C-Bprice) >= PriceScale*50) Then buy("Buy"); } if CrossDown(mav2,mav3) Then { if Sprice == 0 or (Sprice > 0 and abs(C-Sprice) >= PriceScale*50) Then sell("Sell"); } } //청산 if MarketPosition == 1 Then { BH = highest(H,BarsSinceEntry); if MaxEntries == 1 Then HE = LatestEntryPrice(0); if MaxEntries >= 2 and LatestEntryPrice(0) > HE Then HE = LatestEntryPrice(0); if BH >= EntryPrice+PriceScale*익절1 Then { ExitLong("B익절1",AtStop,BH-PriceScale*익절1하락); } ExitLong("B손절",AtStop,HE-PriceScale*손절); } if MarketPosition == -1 Then { SL = Lowest(L,BarsSinceEntry); if MaxEntries == 1 Then LE = LatestEntryPrice(0); if MaxEntries >= 2 and LatestEntryPrice(0) < LE Then LE = LatestEntryPrice(0); if SL <= EntryPrice-PriceScale*익절1 Then { ExitShort("S익절1",AtStop,SL+PriceScale*익절1하락); } ExitShort("S손절",AtStop,LE+PriceScale*손절); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2018-05-29 14:02:12

안녕하세요 예스스탁입니다. 식을 수정했습니다. input : P1(3),P2(10),P3(180); var : mav2(0),mav3(0); input : 익절1(100),익절1하락(50),손절(80); var : BH(0),SL(0),HE(0),LE(0); input : 시작시간(1016000), 종료시간(004000); var : Tcond(False); #ATR Input : ATR추적(20), ATR손절(20); # Var : PosHigh(0), PosLow(0); var : UpCount(0), UpPrice(0); var : DnCount(0), DnPrice(0); mav2 = ma(c,P2); mav3 = ma(c,P3); if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{ Tcond = true; UpCount = 0; DnCount = 0; } if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{ Tcond = false; } if Tcond == true Then { if crossup(mav2,mav3) Then { UpPrice = C; UpCount = UpCount+1; if UpCount == 0 or (UpCount > 0 and abs(C-UpPrice) >= PriceScale*50) Then buy("Buy"); } if CrossDown(mav2,mav3) Then { DnPrice = C; DnCount = DnCount+1; if DnCount == 0 or (DnCount > 0 and abs(C-DnPrice) >= PriceScale*50) Then sell("Sell"); } } //청산 if MarketPosition == 1 Then { BH = highest(H,BarsSinceEntry); if MaxEntries == 1 Then HE = LatestEntryPrice(0); if MaxEntries >= 2 and LatestEntryPrice(0) > HE Then HE = LatestEntryPrice(0); if BH >= EntryPrice+PriceScale*익절1 Then { ExitLong("B익절1",AtStop,BH-PriceScale*익절1하락); } ExitLong("B손절",AtStop,HE-PriceScale*손절); } if MarketPosition == -1 Then { SL = Lowest(L,BarsSinceEntry); if MaxEntries == 1 Then LE = LatestEntryPrice(0); if MaxEntries >= 2 and LatestEntryPrice(0) < LE Then LE = LatestEntryPrice(0); if SL <= EntryPrice-PriceScale*익절1 Then { ExitShort("S익절1",AtStop,SL+PriceScale*익절1하락); } ExitShort("S손절",AtStop,LE+PriceScale*손절); } 즐거운 하루되세요 > 라떼처럼 님이 쓴 글입니다. > 제목 : 수식이 요청사항과 달라 다시 요청드립니다.^^ > 수식이 요청사항과 달라 다시 요청드립니다. 1계약이며, 거래시간 동안 이전 매수, 매도 진입 값을 기억하고 두번째 진입시 조건 만족시 매수 매도 진입하는 것입니다. 그림 참조 부탁드립니다. 거래시간 동안 1. Crossup(mav2,nmav3) ⓐ첫번째 매수진입값 --> 청산 또는 Crossdown(mav2,nmav3)에 의한 전환. ⓑ두번째 Crossup(mav2,nmav3) 매수진입은 ⓐ첫번째 매수진입값과 ±50 차이가 날때만 매수 진입 -->청산 또는 Crossdown(mav2,nmav3)에 의한 전환 ⓒ세번째 진입은 ⓑ두번째 매수진입값 참조, ⓓ네번째 진입은 ⓒ세번째 매수 진입값 참조....,... "Buy"에만 해당되며 "reBuy"는 상기 조건에 해당되지 않습니다 매도 쪽도 같은식으로 추가 부탁드립디다 input : P1(3),P2(10),P3(180); var : mav2(0),mav3(0); input : 익절1(100),익절1하락(50),손절(80); var : BH(0),SL(0),HE(0),LE(0); input : 시작시간(1016000), 종료시간(004000); var : Tcond(False); #ATR Input : ATR추적(20), ATR손절(20); # Var : PosHigh(0), PosLow(0); var : Bprice(0), Sprice(0); mav2 = ma(c,P2); mav3 = ma(c,P3); if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{ Tcond = true; Bprice = 0; Sprice = 0; } if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{ Tcond = false; } if TotalTrades > TotalTrades[1] and MarketPosition == 1 Then{ Bprice = EntryPrice(1); } if TotalTrades > TotalTrades[1] and MarketPosition == -1 Then{ Sprice = EntryPrice(1); } // if Tcond == true Then{ if crossup(mav2,mav3) Then { if Bprice == 0 or (Bprice > 0 and abs(C-Bprice) >= PriceScale*50) Then buy("Buy"); } if CrossDown(mav2,mav3) Then { if Sprice == 0 or (Sprice > 0 and abs(C-Sprice) >= PriceScale*50) Then sell("Sell"); } } //청산 if MarketPosition == 1 Then { BH = highest(H,BarsSinceEntry); if MaxEntries == 1 Then HE = LatestEntryPrice(0); if MaxEntries >= 2 and LatestEntryPrice(0) > HE Then HE = LatestEntryPrice(0); if BH >= EntryPrice+PriceScale*익절1 Then { ExitLong("B익절1",AtStop,BH-PriceScale*익절1하락); } ExitLong("B손절",AtStop,HE-PriceScale*손절); } if MarketPosition == -1 Then { SL = Lowest(L,BarsSinceEntry); if MaxEntries == 1 Then LE = LatestEntryPrice(0); if MaxEntries >= 2 and LatestEntryPrice(0) < LE Then LE = LatestEntryPrice(0); if SL <= EntryPrice-PriceScale*익절1 Then { ExitShort("S익절1",AtStop,SL+PriceScale*익절1하락); } ExitShort("S손절",AtStop,LE+PriceScale*손절); }