커뮤니티

수식 검토 요청드립니다.

프로필 이미지
고박사122
2017-05-23 16:00:36
106
글번호 109795
답변완료
안녕하세요 아래 수식을 적용해 보면 신호가 나오질 않습니다. 검토 부탁드립니다. > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 수식변경 요청드립니다. > 안녕하세요 예스스탁입니다. input : 거래시간1(1), 시작시간1(160000), 끝시간1(045500),익절틱수 (30),손절틱수 (15); input : P1(5),P2(20); var : AA(0),BB(0),HH(0),LL(0),vol(0); if 거래시간1 == 1 then condition3 = (stime>=시작시간1 or stime<=끝시간1); Else if 거래시간1 == 2 then condition3 = (stime>=시작시간1 and stime<=끝시간1); Else condition3 = true; AA = ma(C,P1); BB = ma(C,P2); if TotalTrades > TotalTrades[1] Then{ if IsExitName("bx",1) or IsExitName("sx",1) Then vol = MaxContracts(1)*2; Else Vol = 1; } if MarketPosition == 0 and TotalTrades == TotalTrades[1] and Condition3 == true and ((BB > BB[1] and C < AA and C < O) or (BB > BB[1] and C < AA and C < BB and C < O)) Then Buy("b",OnClose,def,vol); if MarketPosition == 1 Then{ HH = Floor((highest(H,BarsSinceEntry) - EntryPrice)/(PriceScale*손절틱수)); ExitLong("bx",AtStop,(EntryPrice-(PriceScale*손절틱수))+(PriceScale*손절틱수)*HH); } if MarketPosition == -1 Then{ LL = Floor((Lowest(L,BarsSinceEntry)-EntryPrice)/(PriceScale*손절틱수)); ExitShort("sx",AtStop,(EntryPrice+(PriceScale*손절틱수))-(PriceScale*손절틱수)*LL); } SetStopProfittarget(PriceScale*익절틱수,PointStop); if stime == 끝시간1 or (stime > 끝시간1 and stime[1] < 끝시간1) Then{ if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); } 즐거운 하루되세요 > 고박사122 님이 쓴 글입니다. > 제목 : 수식변경 요청드립니다. > 안녕하세요. 다음 식의 변경을 요청드립니다. 추가해야 할 조건은 첫진입 계약은 1계약으로 시작하고 손절 시 그다음 진입시 계약수가 앞전 계약수의 2배가 되도록 하며 수익 시 다시 1계약으로 셋팅되도록 부탁드립니다. input : 거래시간1(1), 시작시간1(160000), 끝시간1(045500),익절틱수 (30),손절틱수 (15); input : P1(5),P2(20); var : AA(0),BB(0),HH(0),LL(0); if 거래시간1 == 1 then condition3 = (stime>=시작시간1 or stime<=끝시간1); Else if 거래시간1 == 2 then condition3 = (stime>=시작시간1 and stime<=끝시간1); Else condition3 = true; AA = ma(C,P1); BB = ma(C,P2); if MarketPosition == 0 and TotalTrades == TotalTrades[1] and Condition3 == true and ((BB > BB[1] and C < AA and C < O) or (BB > BB[1] and C < AA and C < BB and C < O)) Then Buy(); if MarketPosition == 1 Then{ HH = Floor((highest(H,BarsSinceEntry) - EntryPrice)/(PriceScale*손절틱수)); ExitLong("bx",AtStop,(EntryPrice-(PriceScale*손절틱수))+(PriceScale*손절틱수)*HH); } if MarketPosition == -1 Then{ LL = Floor((Lowest(L,BarsSinceEntry)-EntryPrice)/(PriceScale*손절틱수)); ExitShort("sx",AtStop,(EntryPrice+(PriceScale*손절틱수))-(PriceScale*손절틱수)*LL); } SetStopProfittarget(PriceScale*익절틱수,PointStop); if stime == 끝시간1 or (stime > 끝시간1 and stime[1] < 끝시간1) Then{ if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-05-23 16:23:48

안녕하세요 예스스탁입니다. vol변수의 선언시 초기값이 1이어야 합니다 아래는 수정한 식입니다. input : 거래시간1(1), 시작시간1(160000), 끝시간1(045500),익절틱수 (30),손절틱수 (15); input : P1(5),P2(20); var : AA(0),BB(0),HH(0),LL(0),vol(1); if 거래시간1 == 1 then condition3 = (stime>=시작시간1 or stime<=끝시간1); Else if 거래시간1 == 2 then condition3 = (stime>=시작시간1 and stime<=끝시간1); Else condition3 = true; AA = ma(C,P1); BB = ma(C,P2); if TotalTrades > TotalTrades[1] Then{ if IsExitName("bx",1) or IsExitName("sx",1) Then vol = MaxContracts(1)*2; Else Vol = 1; } if MarketPosition == 0 and TotalTrades == TotalTrades[1] and Condition3 == true and ((BB > BB[1] and C < AA and C < O) or (BB > BB[1] and C < AA and C < BB and C < O)) Then Buy("b",OnClose,def,vol); if MarketPosition == 1 Then{ HH = Floor((highest(H,BarsSinceEntry) - EntryPrice)/(PriceScale*손절틱수)); ExitLong("bx",AtStop,(EntryPrice-(PriceScale*손절틱수))+(PriceScale*손절틱수)*HH); } if MarketPosition == -1 Then{ LL = Floor((Lowest(L,BarsSinceEntry)-EntryPrice)/(PriceScale*손절틱수)); ExitShort("sx",AtStop,(EntryPrice+(PriceScale*손절틱수))-(PriceScale*손절틱수)*LL); } SetStopProfittarget(PriceScale*익절틱수,PointStop); if stime == 끝시간1 or (stime > 끝시간1 and stime[1] < 끝시간1) Then{ if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); } 즐거운 하루되세요 > 고박사122 님이 쓴 글입니다. > 제목 : 수식 검토 요청드립니다. > 안녕하세요 아래 수식을 적용해 보면 신호가 나오질 않습니다. 검토 부탁드립니다. > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 수식변경 요청드립니다. > 안녕하세요 예스스탁입니다. input : 거래시간1(1), 시작시간1(160000), 끝시간1(045500),익절틱수 (30),손절틱수 (15); input : P1(5),P2(20); var : AA(0),BB(0),HH(0),LL(0),vol(0); if 거래시간1 == 1 then condition3 = (stime>=시작시간1 or stime<=끝시간1); Else if 거래시간1 == 2 then condition3 = (stime>=시작시간1 and stime<=끝시간1); Else condition3 = true; AA = ma(C,P1); BB = ma(C,P2); if TotalTrades > TotalTrades[1] Then{ if IsExitName("bx",1) or IsExitName("sx",1) Then vol = MaxContracts(1)*2; Else Vol = 1; } if MarketPosition == 0 and TotalTrades == TotalTrades[1] and Condition3 == true and ((BB > BB[1] and C < AA and C < O) or (BB > BB[1] and C < AA and C < BB and C < O)) Then Buy("b",OnClose,def,vol); if MarketPosition == 1 Then{ HH = Floor((highest(H,BarsSinceEntry) - EntryPrice)/(PriceScale*손절틱수)); ExitLong("bx",AtStop,(EntryPrice-(PriceScale*손절틱수))+(PriceScale*손절틱수)*HH); } if MarketPosition == -1 Then{ LL = Floor((Lowest(L,BarsSinceEntry)-EntryPrice)/(PriceScale*손절틱수)); ExitShort("sx",AtStop,(EntryPrice+(PriceScale*손절틱수))-(PriceScale*손절틱수)*LL); } SetStopProfittarget(PriceScale*익절틱수,PointStop); if stime == 끝시간1 or (stime > 끝시간1 and stime[1] < 끝시간1) Then{ if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); } 즐거운 하루되세요 > 고박사122 님이 쓴 글입니다. > 제목 : 수식변경 요청드립니다. > 안녕하세요. 다음 식의 변경을 요청드립니다. 추가해야 할 조건은 첫진입 계약은 1계약으로 시작하고 손절 시 그다음 진입시 계약수가 앞전 계약수의 2배가 되도록 하며 수익 시 다시 1계약으로 셋팅되도록 부탁드립니다. input : 거래시간1(1), 시작시간1(160000), 끝시간1(045500),익절틱수 (30),손절틱수 (15); input : P1(5),P2(20); var : AA(0),BB(0),HH(0),LL(0); if 거래시간1 == 1 then condition3 = (stime>=시작시간1 or stime<=끝시간1); Else if 거래시간1 == 2 then condition3 = (stime>=시작시간1 and stime<=끝시간1); Else condition3 = true; AA = ma(C,P1); BB = ma(C,P2); if MarketPosition == 0 and TotalTrades == TotalTrades[1] and Condition3 == true and ((BB > BB[1] and C < AA and C < O) or (BB > BB[1] and C < AA and C < BB and C < O)) Then Buy(); if MarketPosition == 1 Then{ HH = Floor((highest(H,BarsSinceEntry) - EntryPrice)/(PriceScale*손절틱수)); ExitLong("bx",AtStop,(EntryPrice-(PriceScale*손절틱수))+(PriceScale*손절틱수)*HH); } if MarketPosition == -1 Then{ LL = Floor((Lowest(L,BarsSinceEntry)-EntryPrice)/(PriceScale*손절틱수)); ExitShort("sx",AtStop,(EntryPrice+(PriceScale*손절틱수))-(PriceScale*손절틱수)*LL); } SetStopProfittarget(PriceScale*익절틱수,PointStop); if stime == 끝시간1 or (stime > 끝시간1 and stime[1] < 끝시간1) Then{ if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); }