커뮤니티

수식검토 부탁드립니다.

프로필 이미지
고박사122
2021-07-17 17:55:51
1226
글번호 150835
답변완료
안녕하세요. 운영자님. 무더운 여름 고생이 많으시네요. 제가 부탁드릴 사항은 1. 스스템의 거래시간이 제대로 적용되지 않는 문제점을 바로잡아 주셨으면 합니다. 2. 진입 수량은 첫진입은 1계약, 실패 시 두번째 진입은 2계약, 또 실패 시 3번째 진입 시 4 계약으로 이런 식으로 누적 진입하다가 성공 시 다시 1계약부터 진입될 수 있도록 부탁드 립니다. input : 거래시간(1),시작시간(160000),끝시간(045500),익절틱수(30),손절틱수(30); INPUT : LENGTH(17),upn(2),dnn(2); VAR : TCHAN1(0), BCHAN1(0),MID(0),TOP2(0),BOT1(0); var : T(0),S(0),HH(0),LL(0); if 거래시간 == 1 then condition3 = (stime>=시작시간 or stime<=끝시간); Else if 거래시간 == 2 then condition3 = (stime>=시작시간 and stime<=끝시간); Else condition3 = true; TCHAN1 = HIGHEST(HIGH+PriceScale*2, LENGTH)[0]; BCHAN1 = LOWEST(LOW-PriceScale*2, LENGTH)[0]; Mid = (TCHAN1+BCHAN1)/2; TOP2 = TCHAN1-PriceScale*6; BOT1 = BCHAN1+PriceScale*6; if CrossUp(C,MID) Then { T = 1; S = 0; } if CrossDown(C,MID) Then { T = -1; S = 0; } if T == 1 Then { if CrossUp(C,TOP2) Then { S = S+1; if S == upn Then Buy(); } } if T == -1 Then { if CrossDown(C,BOT1) Then { S = S+1; if S == dnn Then Sell(); } } if MarketPosition == 1 Then{ LL = Floor((highest(H,BarsSinceEntry) - EntryPrice)/(PriceScale*손절틱수 )); ExitLong("bx",AtStop,(EntryPrice-(PriceScale*손절틱수 ))+(PriceScale*손절틱수 )*LL); } if MarketPosition == -1 Then{ HH = Floor((EntryPrice-Lowest(L,BarsSinceEntry))/(PriceScale*손절틱수 )); ExitShort("sx",AtStop,(EntryPrice+(PriceScale*손절틱수))-(PriceScale*손절틱수 )*HH); } SetStopProfittarget(PriceScale*익절틱수,PointStop); if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간 ) Then{ if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-07-20 10:11:32

안녕하세요 예스스탁입니다. input : 거래시간(1),시작시간(160000),끝시간(045500),익절틱수(30),손절틱수(30); INPUT : LENGTH(17),upn(2),dnn(2); VAR : TCHAN1(0), BCHAN1(0),MID(0),TOP2(0),BOT1(0); var : T(0),S(0),HH(0),LL(0),entry(0),vol(0); if 거래시간 == 1 then { if (sdate != sdate[1] and stime >= 끝시간) or (sdate == sdate[1] and stime >= 끝시간 and stime[1] < 끝시간) Then condition3 = False; if (sdate != sdate[1] and stime >= 시작시간) or (sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then { condition3 = true; entry = 0; } } Else { Condition3 = False; if Bdate != Bdate[1] Then entry = 0; } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; TCHAN1 = HIGHEST(HIGH+PriceScale*2, LENGTH)[0]; BCHAN1 = LOWEST(LOW-PriceScale*2, LENGTH)[0]; Mid = (TCHAN1+BCHAN1)/2; TOP2 = TCHAN1-PriceScale*6; BOT1 = BCHAN1+PriceScale*6; if entry == 0 Then vol = 1; Else { if MarketPosition == 0 Then { if PositionProfit(1) < 0 Then vol = MaxContracts(1)+1; Else vol = 1; } if MarketPosition != 0 Then { if PositionProfit(0) < 0 Then vol = MaxContracts(0)+1; Else vol = 1; } } if CrossUp(C,MID) Then { T = 1; S = 0; } if CrossDown(C,MID) Then { T = -1; S = 0; } if T == 1 Then { if CrossUp(C,TOP2) Then { S = S+1; if S == upn Then Buy("b",OnClose,def,vol); } } if T == -1 Then { if CrossDown(C,BOT1) Then { S = S+1; if S == dnn Then Sell("s",OnClose,def,vol); } } if MarketPosition == 1 Then{ LL = Floor((highest(H,BarsSinceEntry) - EntryPrice)/(PriceScale*손절틱수 )); ExitLong("bx",AtStop,(EntryPrice-(PriceScale*손절틱수 ))+(PriceScale*손절틱수 )*LL); } if MarketPosition == -1 Then{ HH = Floor((EntryPrice-Lowest(L,BarsSinceEntry))/(PriceScale*손절틱수 )); ExitShort("sx",AtStop,(EntryPrice+(PriceScale*손절틱수))-(PriceScale*손절틱수 )*HH); } SetStopProfittarget(PriceScale*익절틱수,PointStop); if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간 ) Then{ if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); } 즐거운 하루되세요 > 고박사122 님이 쓴 글입니다. > 제목 : 수식검토 부탁드립니다. > 안녕하세요. 운영자님. 무더운 여름 고생이 많으시네요. 제가 부탁드릴 사항은 1. 스스템의 거래시간이 제대로 적용되지 않는 문제점을 바로잡아 주셨으면 합니다. 2. 진입 수량은 첫진입은 1계약, 실패 시 두번째 진입은 2계약, 또 실패 시 3번째 진입 시 4 계약으로 이런 식으로 누적 진입하다가 성공 시 다시 1계약부터 진입될 수 있도록 부탁드 립니다. input : 거래시간(1),시작시간(160000),끝시간(045500),익절틱수(30),손절틱수(30); INPUT : LENGTH(17),upn(2),dnn(2); VAR : TCHAN1(0), BCHAN1(0),MID(0),TOP2(0),BOT1(0); var : T(0),S(0),HH(0),LL(0); if 거래시간 == 1 then condition3 = (stime>=시작시간 or stime<=끝시간); Else if 거래시간 == 2 then condition3 = (stime>=시작시간 and stime<=끝시간); Else condition3 = true; TCHAN1 = HIGHEST(HIGH+PriceScale*2, LENGTH)[0]; BCHAN1 = LOWEST(LOW-PriceScale*2, LENGTH)[0]; Mid = (TCHAN1+BCHAN1)/2; TOP2 = TCHAN1-PriceScale*6; BOT1 = BCHAN1+PriceScale*6; if CrossUp(C,MID) Then { T = 1; S = 0; } if CrossDown(C,MID) Then { T = -1; S = 0; } if T == 1 Then { if CrossUp(C,TOP2) Then { S = S+1; if S == upn Then Buy(); } } if T == -1 Then { if CrossDown(C,BOT1) Then { S = S+1; if S == dnn Then Sell(); } } if MarketPosition == 1 Then{ LL = Floor((highest(H,BarsSinceEntry) - EntryPrice)/(PriceScale*손절틱수 )); ExitLong("bx",AtStop,(EntryPrice-(PriceScale*손절틱수 ))+(PriceScale*손절틱수 )*LL); } if MarketPosition == -1 Then{ HH = Floor((EntryPrice-Lowest(L,BarsSinceEntry))/(PriceScale*손절틱수 )); ExitShort("sx",AtStop,(EntryPrice+(PriceScale*손절틱수))-(PriceScale*손절틱수 )*HH); } SetStopProfittarget(PriceScale*익절틱수,PointStop); if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간 ) Then{ if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); }