커뮤니티

수식 부탁 드립니다.

프로필 이미지
dandy
2016-11-21 13:09:02
116
글번호 104183
답변완료
안녕하세요. 연결선물 당일청산 피라미딩 아래 수식에서 목표 청산 후 재진입이 안되네요. 차트에 적용 수식 점검 수정 부탁 드립니다. input : N(1),PN(2),당일손실(1.0); var : cnt(0),BCount(0),SCount(0); var : NP(0),PreNP(0),DayPL(0),lossK(0),v1(0); var : Bxcond(false),SxCond(false); var : Xcond(false),ProfitCond(false); var : BE2(false),BE3(false),SE2(false),SE3(false); var : B2(0),B3(0),S2(0),S3(0); NP = NetProfit; if date != date[1] Then{ preNP = NP[1]; Condition1 = false; v1 = 0; Xcond == false; ProfitCond == false; } dayPL = NP-PreNP; BCount = 0 ; SCount = 0 ; for cnt = 0 to 10 { if EntryDate(cnt) == sdate and MarketPosition(cnt) == 1 then BCount = BCount + 1; if EntryDate(cnt) == sdate and MarketPosition(cnt) == -1 then SCount = SCount + 1; } if Condition1 == false and TotalTrades > TotalTrades[1] Then{ Condition1 = true; if PositionProfit(1) > 0 Then v1 = PositionProfit(1); } //======================================================================================================= #당일손실제한 if MarketPosition == 1 Then{ ExitLong("당일손실제한bx3",AtStop,avgEntryPrice-(당일손실+(dayPL-v1))/CurrentContracts); } if MarketPosition == -1 Then{ ExitShort("당일손실제한sx3",AtStop,avgEntryPrice+(당일손실+(dayPL-v1))/CurrentContracts); } //======================================================================================================= #피라미딩진입수식 Input : i증감(0.2),누적진입횟수(3),진입수량(1); if MarketPosition == 1 and MaxEntries < 누적진입횟수 and Bxcond == false Then Buy("PBB",AtStop,LatestEntryPrice(0)+i증감,진입수량); if MarketPosition == -1 and MaxEntries < 누적진입횟수 and SxCond == false Then sell("PSS",AtStop,LatestEntryPrice(0)-i증감,진입수량); //======================================================================================================= #합산목표수익청산 Input : SPPT(2.0); SetStopPosition; SetStopProfittarget(SPPT,PointStop); //======================================================================================================= # 목표청산 재진입 input : ATRP(10),X(2); var1 = ma(c,5); var2 = ma(c,10); #직전거래가 매수포지션이고 SetStopProfittarget으로 청산했으면 #이평 데드일때 매도진입 if MarketPosition == 0 and MarketPosition(1) == -1 and IsEntryName("StopProfitTarget",1) == true and BCount == true and CrossDown(var1,var2) Then Buy("rebuy"); #직전거래가 매도포지션이고 SetStopProfittarget으로 청산했으면 #이평 골드일때 매수진입 if MarketPosition == 0 and MarketPosition(1) == -1 and IsEntryName("StopProfitTarget",1) == true and SCount == true and CrossDown(var1,var2) Then sell("resell"); if MarketPosition == 1 and IsEntryName("rebuy") == true then { ExitLong("bx",AtStop,EntryPrice-0.5); ExitLong("btr",AtStop,highest(H,BarsSinceEntry)-ATR(ATRP)*X); } if MarketPosition == -1 and IsEntryName("resell") == true then { ExitShort("sx",AtStop,EntryPrice-0.5); ExitShort("str",AtStop,highest(H,BarsSinceEntry)+ATR(ATRP)*X); } SetStopPosition; if IsEntryName("rebuy") == false or IsEntryName("resell") == false then SetStopProfittarget(1.5,PointStop); Else SetStopProfittarget(0);#해제 //======================================================================================================= #진입식예제 Input : Period(12), Period1(5); Var : value(0); value = StochasticsK(Period,Period1); # 매수/매도청산 If CrossUP(value, 20) and BCount+SCount < N and dayPL > -당일손실 Then { Buy(); } # 매도/매수청산 If CrossDown(value, 80) and BCount+SCount < N and dayPL > -당일손실 Then { Sell(); } //===================================================================================================== #당일 청산시간 SetStopEndofday(153000); //=====================================================================================================
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2016-11-21 16:54:24

안녕하세요 예스스탁입니다. 식을 수정했습니다. input : N(1),PN(2),당일손실(1.0); var : cnt(0),BCount(0),SCount(0); var : NP(0),PreNP(0),DayPL(0),lossK(0),v1(0); var : Bxcond(false),SxCond(false); var : Xcond(false),ProfitCond(false); var : BE2(false),BE3(false),SE2(false),SE3(false); var : B2(0),B3(0),S2(0),S3(0); NP = NetProfit; if date != date[1] Then{ preNP = NP[1]; Condition1 = false; v1 = 0; Xcond == false; ProfitCond == false; } dayPL = NP-PreNP; BCount = 0 ; SCount = 0 ; for cnt = 0 to 10 { if EntryDate(cnt) == sdate and MarketPosition(cnt) == 1 then BCount = BCount + 1; if EntryDate(cnt) == sdate and MarketPosition(cnt) == -1 then SCount = SCount + 1; } if Condition1 == false and TotalTrades > TotalTrades[1] Then{ Condition1 = true; if PositionProfit(1) > 0 Then v1 = PositionProfit(1); } //======================================================================================================= #당일손실제한 if MarketPosition == 1 Then{ ExitLong("당일손실제한bx3",AtStop,avgEntryPrice-(당일손실+(dayPL-v1))/CurrentContracts); } if MarketPosition == -1 Then{ ExitShort("당일손실제한sx3",AtStop,avgEntryPrice+(당일손실+(dayPL-v1))/CurrentContracts); } //======================================================================================================= #피라미딩진입수식 Input : i증감(0.2),누적진입횟수(3),진입수량(1); if MarketPosition == 1 and MaxEntries < 누적진입횟수 and Bxcond == false Then Buy("PBB",AtStop,LatestEntryPrice(0)+i증감,진입수량); if MarketPosition == -1 and MaxEntries < 누적진입횟수 and SxCond == false Then sell("PSS",AtStop,LatestEntryPrice(0)-i증감,진입수량); //======================================================================================================= //======================================================================================================= # 목표청산 재진입 input : ATRP(10),X(2); var1 = ma(c,5); var2 = ma(c,10); #직전거래가 매수포지션이고 SetStopProfittarget으로 청산했으면 #이평 데드일때 매도진입 if MarketPosition == 0 and MarketPosition(1) == 1 and IsExitName("StopProfitTarget",1) == true and CrossDown(var1,var2) Then Buy("rebuy"); #직전거래가 매도포지션이고 SetStopProfittarget으로 청산했으면 #이평 골드일때 매수진입 if MarketPosition == 0 and MarketPosition(1) == -1 and IsExitName("StopProfitTarget",1) == true and CrossDown(var1,var2) Then sell("resell"); if MarketPosition == 1 and IsEntryName("rebuy") == true then { ExitLong("bx",AtStop,EntryPrice-0.5); ExitLong("btr",AtStop,highest(H,BarsSinceEntry)-ATR(ATRP)*X); } if MarketPosition == -1 and IsEntryName("resell") == true then { ExitShort("sx",AtStop,EntryPrice-0.5); ExitShort("str",AtStop,highest(H,BarsSinceEntry)+ATR(ATRP)*X); } #합산목표수익청산 Input : SPPT(2.0); SetStopPosition; if IsEntryName("rebuy") == true or IsEntryName("resell") == true then SetStopProfittarget(1.5,PointStop); Else SetStopProfittarget(SPPT,PointStop); //======================================================================================================= #진입식예제 Input : Period(12), Period1(5); Var : value(0); value = StochasticsK(Period,Period1); # 매수/매도청산 If CrossUP(value, 20) and BCount+SCount < N and dayPL > -당일손실 Then { Buy(); } # 매도/매수청산 If CrossDown(value, 80) and BCount+SCount < N and dayPL > -당일손실 Then { Sell(); } //===================================================================================================== #당일 청산시간 SetStopEndofday(153000); //===================================================================================================== 즐거운 하루되세요 > dandy 님이 쓴 글입니다. > 제목 : 수식 부탁 드립니다. > 안녕하세요. 연결선물 당일청산 피라미딩 아래 수식에서 목표 청산 후 재진입이 안되네요. 차트에 적용 수식 점검 수정 부탁 드립니다. input : N(1),PN(2),당일손실(1.0); var : cnt(0),BCount(0),SCount(0); var : NP(0),PreNP(0),DayPL(0),lossK(0),v1(0); var : Bxcond(false),SxCond(false); var : Xcond(false),ProfitCond(false); var : BE2(false),BE3(false),SE2(false),SE3(false); var : B2(0),B3(0),S2(0),S3(0); NP = NetProfit; if date != date[1] Then{ preNP = NP[1]; Condition1 = false; v1 = 0; Xcond == false; ProfitCond == false; } dayPL = NP-PreNP; BCount = 0 ; SCount = 0 ; for cnt = 0 to 10 { if EntryDate(cnt) == sdate and MarketPosition(cnt) == 1 then BCount = BCount + 1; if EntryDate(cnt) == sdate and MarketPosition(cnt) == -1 then SCount = SCount + 1; } if Condition1 == false and TotalTrades > TotalTrades[1] Then{ Condition1 = true; if PositionProfit(1) > 0 Then v1 = PositionProfit(1); } //======================================================================================================= #당일손실제한 if MarketPosition == 1 Then{ ExitLong("당일손실제한bx3",AtStop,avgEntryPrice-(당일손실+(dayPL-v1))/CurrentContracts); } if MarketPosition == -1 Then{ ExitShort("당일손실제한sx3",AtStop,avgEntryPrice+(당일손실+(dayPL-v1))/CurrentContracts); } //======================================================================================================= #피라미딩진입수식 Input : i증감(0.2),누적진입횟수(3),진입수량(1); if MarketPosition == 1 and MaxEntries < 누적진입횟수 and Bxcond == false Then Buy("PBB",AtStop,LatestEntryPrice(0)+i증감,진입수량); if MarketPosition == -1 and MaxEntries < 누적진입횟수 and SxCond == false Then sell("PSS",AtStop,LatestEntryPrice(0)-i증감,진입수량); //======================================================================================================= #합산목표수익청산 Input : SPPT(2.0); SetStopPosition; SetStopProfittarget(SPPT,PointStop); //======================================================================================================= # 목표청산 재진입 input : ATRP(10),X(2); var1 = ma(c,5); var2 = ma(c,10); #직전거래가 매수포지션이고 SetStopProfittarget으로 청산했으면 #이평 데드일때 매도진입 if MarketPosition == 0 and MarketPosition(1) == -1 and IsEntryName("StopProfitTarget",1) == true and BCount == true and CrossDown(var1,var2) Then Buy("rebuy"); #직전거래가 매도포지션이고 SetStopProfittarget으로 청산했으면 #이평 골드일때 매수진입 if MarketPosition == 0 and MarketPosition(1) == -1 and IsEntryName("StopProfitTarget",1) == true and SCount == true and CrossDown(var1,var2) Then sell("resell"); if MarketPosition == 1 and IsEntryName("rebuy") == true then { ExitLong("bx",AtStop,EntryPrice-0.5); ExitLong("btr",AtStop,highest(H,BarsSinceEntry)-ATR(ATRP)*X); } if MarketPosition == -1 and IsEntryName("resell") == true then { ExitShort("sx",AtStop,EntryPrice-0.5); ExitShort("str",AtStop,highest(H,BarsSinceEntry)+ATR(ATRP)*X); } SetStopPosition; if IsEntryName("rebuy") == false or IsEntryName("resell") == false then SetStopProfittarget(1.5,PointStop); Else SetStopProfittarget(0);#해제 //======================================================================================================= #진입식예제 Input : Period(12), Period1(5); Var : value(0); value = StochasticsK(Period,Period1); # 매수/매도청산 If CrossUP(value, 20) and BCount+SCount < N and dayPL > -당일손실 Then { Buy(); } # 매도/매수청산 If CrossDown(value, 80) and BCount+SCount < N and dayPL > -당일손실 Then { Sell(); } //===================================================================================================== #당일 청산시간 SetStopEndofday(153000); //=====================================================================================================