커뮤니티

time 진입/1차후 2차진입 손절/익절/피라미딩

프로필 이미지
목마와숙녀
2020-01-20 09:07:52
190
글번호 134505
답변완료
문의 드립니다. 1.두번째 진입의 손절2,익절2,tr2 작동되지 않고 첫번째 조건이 모두 적용됩니다. (미니선물1분차트 고가갱신수 10 첫번째 진입 손절1(30),익절1(50),tr1(40) 두번째 진입 손절2(30),익절2(50),tr2(40) 했을때 b1, b2 모두 bl1,bp1,btr1 적용됨 2.두번째 진입에 사용할 피라미밍2 조건 수식이 없습니다. ********************************************************************************** 안녕하세요 예스스탁입니다. input : ntime(090000),n(1); input : 고가갱신수(20); input : uppyra검증(1.20); input : 상승pyra(0.20),상승N(12); input : up손절1(99999),up익절1(99999),upTR1(99999); input : up손절2(99999),up익절2(99999),upTR2(99999); var : BE1(0),BH1(0),BV1(0),BXcond1(false); var : BE2(0),BH2(0),BV2(0),BXcond2(false); if stime == ntime or (stime > ntime and stime[1] < ntime) Then{ if MaxEntries < n Then buy("b1"); } if MarketPosition == 1 and C >= EntryPrice+uppyra검증 and MaxContracts < 상승N Then buy("bb",AtStop,LatestEntryPrice(0)+상승Pyra); if MarketPosition == 0 and #현재무포지션이고 EntryDate(1) == sdate and #직전거래가 오늘 발생한 거래이고 MarketPosition(1) == 1 and #직전거래가 매수거래이고 countif(DayHigh(0) != DayHigh(0)[1],BarsSinceExit(1)) >= 고가갱신수 Then #청산이후 당일고가 갱신이 n회이상 있었으면 buy("b2"); if MarketPosition == 1 then { if CurrentContracts > CurrentContracts[1] Then { if MaxEntries == 1 then { BE1 = LatestEntryPrice(0); Bh1 = h; Bv1 = CurrentContracts-CurrentContracts[1]; BXcond1 = false; } if MaxEntries == 2 then { BE2 = LatestEntryPrice(0); Bh2 = h; Bv2 = CurrentContracts-CurrentContracts[1]; BXcond2 = false; } } if CurrentContracts < CurrentContracts[1] then { if LatestExitName(0) == "bl1" or LatestExitName(0) == "bp1" or LatestExitName(0) == "btr1" Then BXcond1 = true; if LatestExitName(0) == "bl2" or LatestExitName(0) == "bp2" or LatestExitName(0) == "btr2" Then BXcond2 = true; } if MaxEntries >= 1 then { if h > Bh1 Then Bh1 = h; if BXcond1 == false Then { ExitLong("bl1",AtStop,BE1-PriceScale*up손절1,"",BV1,1); ExitLong("bp1",Atlimit,BE1+PriceScale*up익절1,"",BV1,1); ExitLong("btr1",AtStop,Bh1-PriceScale*upTR1,"",BV1,1); } } if MaxEntries >= 2 then { if h > Bh2 Then Bh2 = h; if BXcond2 == false Then { ExitLong("bl2",AtStop,BE2-PriceScale*up손절2,"",BV2,1); ExitLong("bp2",Atlimit,BE2+PriceScale*up익절2,"",BV2,1); ExitLong("btr2",AtStop,Bh2-PriceScale*upTR2,"",BV2,1); } } } else { Bxcond1 = false; Bxcond2 = false; } 즐거운 하루되세요 > 목마와숙녀 님이 쓴 글입니다. > 제목 : 문의 > 아래수식의 손절,익절,TR,피라미딩은 1차 진입과 2차 진입에 공통으로 적용됩니다. 손절,익절,TR,피라미딩을 첫번째 진입과 두번째 진입에 각각 구분하여 적용하고 싶습니다. ************************************************************************************* input : ntime(090000),n(1); input : 고가갱신수(20); input : uppyra검증(1.20); input : 상승pyra(0.20),상승N(12); input : up손절(99999),up익절(99999),upTR(99999); if stime == ntime or (stime > ntime and stime[1] < ntime) Then{ if MaxEntries < n Then buy("b1"); } if MarketPosition == 1 and C >= EntryPrice+uppyra검증 and MaxContracts < 상승N Then buy("bb",AtStop,LatestEntryPrice(0)+상승Pyra); if MarketPosition == 0 and #현재무포지션이고 EntryDate(1) == sdate and #직전거래가 오늘 발생한 거래이고 MarketPosition(1) == 1 and #직전거래가 매수거래이고 countif(DayHigh(0) != DayHigh(0)[1],BarsSinceExit(1)) >= 고가갱신수 Then #청산이후 당일고가 갱신이 n회이상 있었으면 buy("b2"); if MarketPosition == 1 then { ExitLong("bl1",AtStop,EntryPrice-PriceScale*up손절); ExitLong("bp1",Atlimit,EntryPrice+PriceScale*up익절); ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*upTR); }
시스템
답변 3
프로필 이미지

예스스탁 예스스탁 답변

2019-12-18 14:54:06

안녕하세요 예스스탁입니다. 이전식은 매수 --> 매수 --> 매수와 같이 매수가 누적되는 상태에서 처음 발생하는 매수와 두번째 발생하는 매수를 구분해 청산하는 내용이었습니다. b1으로 첫진입을 시작한 포지션과 b2로 첫진입을 시작산 포지션을 구분하시는 용도이시면 아래식 이용하시면 됩니다. input : ntime(090000),n(1); input : 고가갱신수(20); input : uppyra검증1(1.20),상승pyra1(0.20),상승N1(12); input : up손절1(99999),up익절1(99999),upTR1(99999); input : uppyra검증2(1.20),상승pyra2(0.20),상승N2(12); input : up손절2(99999),up익절2(99999),upTR2(99999); if stime == ntime or (stime > ntime and stime[1] < ntime) Then { if MaxEntries < n Then buy("b1"); } if MarketPosition == 0 and #현재무포지션이고 EntryDate(1) == sdate and #직전거래가 오늘 발생한 거래이고 MarketPosition(1) == 1 and #직전거래가 매수거래이고 countif(DayHigh(0) != DayHigh(0)[1],BarsSinceExit(1)) >= 고가갱신수 Then #청산이후 당일고가 갱신이 n회이상 있었으면 buy("b2"); if MarketPosition == 1 and IsEntryName("b1") == true Then { if C >= EntryPrice+uppyra검증1 and MaxContracts < 상승N1 Then buy("bb1",AtStop,LatestEntryPrice(0)+상승Pyra1); ExitLong("bl1",AtStop,EntryPrice-PriceScale*up손절1); ExitLong("bp1",Atlimit,EntryPrice+PriceScale*up익절1); ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*upTR1); } if MarketPosition == 1 and IsEntryName("b2") == true then { if C >= EntryPrice+uppyra검증1 and MaxContracts < 상승N1 Then buy("bb2",AtStop,LatestEntryPrice(0)+상승Pyra1); ExitLong("bl2",AtStop,EntryPrice-PriceScale*up손절2); ExitLong("bp2",Atlimit,EntryPrice+PriceScale*up익절2); ExitLong("btr2",AtStop,highest(h,BarsSinceEntry)-PriceScale*upTR2); } 즐거운 하루되세요 > 목마와숙녀 님이 쓴 글입니다. > 제목 : 문의 > 문의 드립니다. 1.두번째 진입의 손절2,익절2,tr2 작동되지 않고 첫번째 조건이 모두 적용됩니다. (미니선물1분차트 고가갱신수 10 첫번째 진입 손절1(30),익절1(50),tr1(40) 두번째 진입 손절2(30),익절2(50),tr2(40) 했을때 b1, b2 모두 bl1,bp1,btr1 적용됨 2.두번째 진입에 사용할 피라미밍2 조건 수식이 없습니다. ********************************************************************************** 안녕하세요 예스스탁입니다. input : ntime(090000),n(1); input : 고가갱신수(20); input : uppyra검증(1.20); input : 상승pyra(0.20),상승N(12); input : up손절1(99999),up익절1(99999),upTR1(99999); input : up손절2(99999),up익절2(99999),upTR2(99999); var : BE1(0),BH1(0),BV1(0),BXcond1(false); var : BE2(0),BH2(0),BV2(0),BXcond2(false); if stime == ntime or (stime > ntime and stime[1] < ntime) Then{ if MaxEntries < n Then buy("b1"); } if MarketPosition == 1 and C >= EntryPrice+uppyra검증 and MaxContracts < 상승N Then buy("bb",AtStop,LatestEntryPrice(0)+상승Pyra); if MarketPosition == 0 and #현재무포지션이고 EntryDate(1) == sdate and #직전거래가 오늘 발생한 거래이고 MarketPosition(1) == 1 and #직전거래가 매수거래이고 countif(DayHigh(0) != DayHigh(0)[1],BarsSinceExit(1)) >= 고가갱신수 Then #청산이후 당일고가 갱신이 n회이상 있었으면 buy("b2"); if MarketPosition == 1 then { if CurrentContracts > CurrentContracts[1] Then { if MaxEntries == 1 then { BE1 = LatestEntryPrice(0); Bh1 = h; Bv1 = CurrentContracts-CurrentContracts[1]; BXcond1 = false; } if MaxEntries == 2 then { BE2 = LatestEntryPrice(0); Bh2 = h; Bv2 = CurrentContracts-CurrentContracts[1]; BXcond2 = false; } } if CurrentContracts < CurrentContracts[1] then { if LatestExitName(0) == "bl1" or LatestExitName(0) == "bp1" or LatestExitName(0) == "btr1" Then BXcond1 = true; if LatestExitName(0) == "bl2" or LatestExitName(0) == "bp2" or LatestExitName(0) == "btr2" Then BXcond2 = true; } if MaxEntries >= 1 then { if h > Bh1 Then Bh1 = h; if BXcond1 == false Then { ExitLong("bl1",AtStop,BE1-PriceScale*up손절1,"",BV1,1); ExitLong("bp1",Atlimit,BE1+PriceScale*up익절1,"",BV1,1); ExitLong("btr1",AtStop,Bh1-PriceScale*upTR1,"",BV1,1); } } if MaxEntries >= 2 then { if h > Bh2 Then Bh2 = h; if BXcond2 == false Then { ExitLong("bl2",AtStop,BE2-PriceScale*up손절2,"",BV2,1); ExitLong("bp2",Atlimit,BE2+PriceScale*up익절2,"",BV2,1); ExitLong("btr2",AtStop,Bh2-PriceScale*upTR2,"",BV2,1); } } } else { Bxcond1 = false; Bxcond2 = false; } 즐거운 하루되세요 > 목마와숙녀 님이 쓴 글입니다. > 제목 : 문의 > 아래수식의 손절,익절,TR,피라미딩은 1차 진입과 2차 진입에 공통으로 적용됩니다. 손절,익절,TR,피라미딩을 첫번째 진입과 두번째 진입에 각각 구분하여 적용하고 싶습니다. ************************************************************************************* input : ntime(090000),n(1); input : 고가갱신수(20); input : uppyra검증(1.20); input : 상승pyra(0.20),상승N(12); input : up손절(99999),up익절(99999),upTR(99999); if stime == ntime or (stime > ntime and stime[1] < ntime) Then{ if MaxEntries < n Then buy("b1"); } if MarketPosition == 1 and C >= EntryPrice+uppyra검증 and MaxContracts < 상승N Then buy("bb",AtStop,LatestEntryPrice(0)+상승Pyra); if MarketPosition == 0 and #현재무포지션이고 EntryDate(1) == sdate and #직전거래가 오늘 발생한 거래이고 MarketPosition(1) == 1 and #직전거래가 매수거래이고 countif(DayHigh(0) != DayHigh(0)[1],BarsSinceExit(1)) >= 고가갱신수 Then #청산이후 당일고가 갱신이 n회이상 있었으면 buy("b2"); if MarketPosition == 1 then { ExitLong("bl1",AtStop,EntryPrice-PriceScale*up손절); ExitLong("bp1",Atlimit,EntryPrice+PriceScale*up익절); ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*upTR); }
프로필 이미지

목마와숙녀

2019-12-18 16:07:18

마지막 수식은 잘 됩니다. 고맙습니다. 그렇다면 아래 관점은 어떤 관점에서 주신 것인지 좀 자세히 알려주셨으면합니다. 이해하고 검토해보려고요. 그리고 수식에서 수정될 부분은 없는 건가요? 이전식은 매수 --> 매수 --> 매수와 같이 매수가 누적되는 상태에서 처음 발생하는 매수와 두번째 발생하는 매수를 구분해 청산하는 내용이었습니다. **************************************************************************** > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 문의 > 안녕하세요 예스스탁입니다. 이전식은 매수 --> 매수 --> 매수와 같이 매수가 누적되는 상태에서 처음 발생하는 매수와 두번째 발생하는 매수를 구분해 청산하는 내용이었습니다. b1으로 첫진입을 시작한 포지션과 b2로 첫진입을 시작산 포지션을 구분하시는 용도이시면 아래식 이용하시면 됩니다. input : ntime(090000),n(1); input : 고가갱신수(20); input : uppyra검증1(1.20),상승pyra1(0.20),상승N1(12); input : up손절1(99999),up익절1(99999),upTR1(99999); input : uppyra검증2(1.20),상승pyra2(0.20),상승N2(12); input : up손절2(99999),up익절2(99999),upTR2(99999); if stime == ntime or (stime > ntime and stime[1] < ntime) Then { if MaxEntries < n Then buy("b1"); } if MarketPosition == 0 and #현재무포지션이고 EntryDate(1) == sdate and #직전거래가 오늘 발생한 거래이고 MarketPosition(1) == 1 and #직전거래가 매수거래이고 countif(DayHigh(0) != DayHigh(0)[1],BarsSinceExit(1)) >= 고가갱신수 Then #청산이후 당일고가 갱신이 n회이상 있었으면 buy("b2"); if MarketPosition == 1 and IsEntryName("b1") == true Then { if C >= EntryPrice+uppyra검증1 and MaxContracts < 상승N1 Then buy("bb1",AtStop,LatestEntryPrice(0)+상승Pyra1); ExitLong("bl1",AtStop,EntryPrice-PriceScale*up손절1); ExitLong("bp1",Atlimit,EntryPrice+PriceScale*up익절1); ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*upTR1); } if MarketPosition == 1 and IsEntryName("b2") == true then { if C >= EntryPrice+uppyra검증1 and MaxContracts < 상승N1 Then buy("bb2",AtStop,LatestEntryPrice(0)+상승Pyra1); ExitLong("bl2",AtStop,EntryPrice-PriceScale*up손절2); ExitLong("bp2",Atlimit,EntryPrice+PriceScale*up익절2); ExitLong("btr2",AtStop,highest(h,BarsSinceEntry)-PriceScale*upTR2); } 즐거운 하루되세요 > 목마와숙녀 님이 쓴 글입니다. > 제목 : 문의 > 문의 드립니다. 1.두번째 진입의 손절2,익절2,tr2 작동되지 않고 첫번째 조건이 모두 적용됩니다. (미니선물1분차트 고가갱신수 10 첫번째 진입 손절1(30),익절1(50),tr1(40) 두번째 진입 손절2(30),익절2(50),tr2(40) 했을때 b1, b2 모두 bl1,bp1,btr1 적용됨 2.두번째 진입에 사용할 피라미밍2 조건 수식이 없습니다. ********************************************************************************** 안녕하세요 예스스탁입니다. input : ntime(090000),n(1); input : 고가갱신수(20); input : uppyra검증(1.20); input : 상승pyra(0.20),상승N(12); input : up손절1(99999),up익절1(99999),upTR1(99999); input : up손절2(99999),up익절2(99999),upTR2(99999); var : BE1(0),BH1(0),BV1(0),BXcond1(false); var : BE2(0),BH2(0),BV2(0),BXcond2(false); if stime == ntime or (stime > ntime and stime[1] < ntime) Then{ if MaxEntries < n Then buy("b1"); } if MarketPosition == 1 and C >= EntryPrice+uppyra검증 and MaxContracts < 상승N Then buy("bb",AtStop,LatestEntryPrice(0)+상승Pyra); if MarketPosition == 0 and #현재무포지션이고 EntryDate(1) == sdate and #직전거래가 오늘 발생한 거래이고 MarketPosition(1) == 1 and #직전거래가 매수거래이고 countif(DayHigh(0) != DayHigh(0)[1],BarsSinceExit(1)) >= 고가갱신수 Then #청산이후 당일고가 갱신이 n회이상 있었으면 buy("b2"); if MarketPosition == 1 then { if CurrentContracts > CurrentContracts[1] Then { if MaxEntries == 1 then { BE1 = LatestEntryPrice(0); Bh1 = h; Bv1 = CurrentContracts-CurrentContracts[1]; BXcond1 = false; } if MaxEntries == 2 then { BE2 = LatestEntryPrice(0); Bh2 = h; Bv2 = CurrentContracts-CurrentContracts[1]; BXcond2 = false; } } if CurrentContracts < CurrentContracts[1] then { if LatestExitName(0) == "bl1" or LatestExitName(0) == "bp1" or LatestExitName(0) == "btr1" Then BXcond1 = true; if LatestExitName(0) == "bl2" or LatestExitName(0) == "bp2" or LatestExitName(0) == "btr2" Then BXcond2 = true; } if MaxEntries >= 1 then { if h > Bh1 Then Bh1 = h; if BXcond1 == false Then { ExitLong("bl1",AtStop,BE1-PriceScale*up손절1,"",BV1,1); ExitLong("bp1",Atlimit,BE1+PriceScale*up익절1,"",BV1,1); ExitLong("btr1",AtStop,Bh1-PriceScale*upTR1,"",BV1,1); } } if MaxEntries >= 2 then { if h > Bh2 Then Bh2 = h; if BXcond2 == false Then { ExitLong("bl2",AtStop,BE2-PriceScale*up손절2,"",BV2,1); ExitLong("bp2",Atlimit,BE2+PriceScale*up익절2,"",BV2,1); ExitLong("btr2",AtStop,Bh2-PriceScale*upTR2,"",BV2,1); } } } else { Bxcond1 = false; Bxcond2 = false; } 즐거운 하루되세요 > 목마와숙녀 님이 쓴 글입니다. > 제목 : 문의 > 아래수식의 손절,익절,TR,피라미딩은 1차 진입과 2차 진입에 공통으로 적용됩니다. 손절,익절,TR,피라미딩을 첫번째 진입과 두번째 진입에 각각 구분하여 적용하고 싶습니다. ************************************************************************************* input : ntime(090000),n(1); input : 고가갱신수(20); input : uppyra검증(1.20); input : 상승pyra(0.20),상승N(12); input : up손절(99999),up익절(99999),upTR(99999); if stime == ntime or (stime > ntime and stime[1] < ntime) Then{ if MaxEntries < n Then buy("b1"); } if MarketPosition == 1 and C >= EntryPrice+uppyra검증 and MaxContracts < 상승N Then buy("bb",AtStop,LatestEntryPrice(0)+상승Pyra); if MarketPosition == 0 and #현재무포지션이고 EntryDate(1) == sdate and #직전거래가 오늘 발생한 거래이고 MarketPosition(1) == 1 and #직전거래가 매수거래이고 countif(DayHigh(0) != DayHigh(0)[1],BarsSinceExit(1)) >= 고가갱신수 Then #청산이후 당일고가 갱신이 n회이상 있었으면 buy("b2"); if MarketPosition == 1 then { ExitLong("bl1",AtStop,EntryPrice-PriceScale*up손절); ExitLong("bp1",Atlimit,EntryPrice+PriceScale*up익절); ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*upTR); }
프로필 이미지

예스스탁 예스스탁 답변

2019-12-18 16:38:12

안녕하세요 예스스탁입니다. 사용하시는 식에서 피라미딩을 하면 b1 또는 b2로 첫매수가 되고 이후에 추가매수(bb)가 발생합니다. 첫매수 --> 추가매수 이때 첫매수와 추가매수를 구분해서 각기 다르게 손절이나 익절, tr이 동작하게 작성해 드린식입니다. 처음 올려드린 수식은 첫매수 후에 추가매수를 1회만 해서 총 2회 한다는 가정에 작성해 드린식입니다. 만약 추가매수를 그 이상하면 그횟수만큼 수식을 추가로 작성해서 늘려가야 합니다. 즐거운 하루되세요 > 목마와숙녀 님이 쓴 글입니다. > 제목 : Re : Re : 문의 > 마지막 수식은 잘 됩니다. 고맙습니다. 그렇다면 아래 관점은 어떤 관점에서 주신 것인지 좀 자세히 알려주셨으면합니다. 이해하고 검토해보려고요. 그리고 수식에서 수정될 부분은 없는 건가요? 이전식은 매수 --> 매수 --> 매수와 같이 매수가 누적되는 상태에서 처음 발생하는 매수와 두번째 발생하는 매수를 구분해 청산하는 내용이었습니다. **************************************************************************** > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 문의 > 안녕하세요 예스스탁입니다. 이전식은 매수 --> 매수 --> 매수와 같이 매수가 누적되는 상태에서 처음 발생하는 매수와 두번째 발생하는 매수를 구분해 청산하는 내용이었습니다. b1으로 첫진입을 시작한 포지션과 b2로 첫진입을 시작산 포지션을 구분하시는 용도이시면 아래식 이용하시면 됩니다. input : ntime(090000),n(1); input : 고가갱신수(20); input : uppyra검증1(1.20),상승pyra1(0.20),상승N1(12); input : up손절1(99999),up익절1(99999),upTR1(99999); input : uppyra검증2(1.20),상승pyra2(0.20),상승N2(12); input : up손절2(99999),up익절2(99999),upTR2(99999); if stime == ntime or (stime > ntime and stime[1] < ntime) Then { if MaxEntries < n Then buy("b1"); } if MarketPosition == 0 and #현재무포지션이고 EntryDate(1) == sdate and #직전거래가 오늘 발생한 거래이고 MarketPosition(1) == 1 and #직전거래가 매수거래이고 countif(DayHigh(0) != DayHigh(0)[1],BarsSinceExit(1)) >= 고가갱신수 Then #청산이후 당일고가 갱신이 n회이상 있었으면 buy("b2"); if MarketPosition == 1 and IsEntryName("b1") == true Then { if C >= EntryPrice+uppyra검증1 and MaxContracts < 상승N1 Then buy("bb1",AtStop,LatestEntryPrice(0)+상승Pyra1); ExitLong("bl1",AtStop,EntryPrice-PriceScale*up손절1); ExitLong("bp1",Atlimit,EntryPrice+PriceScale*up익절1); ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*upTR1); } if MarketPosition == 1 and IsEntryName("b2") == true then { if C >= EntryPrice+uppyra검증1 and MaxContracts < 상승N1 Then buy("bb2",AtStop,LatestEntryPrice(0)+상승Pyra1); ExitLong("bl2",AtStop,EntryPrice-PriceScale*up손절2); ExitLong("bp2",Atlimit,EntryPrice+PriceScale*up익절2); ExitLong("btr2",AtStop,highest(h,BarsSinceEntry)-PriceScale*upTR2); } 즐거운 하루되세요 > 목마와숙녀 님이 쓴 글입니다. > 제목 : 문의 > 문의 드립니다. 1.두번째 진입의 손절2,익절2,tr2 작동되지 않고 첫번째 조건이 모두 적용됩니다. (미니선물1분차트 고가갱신수 10 첫번째 진입 손절1(30),익절1(50),tr1(40) 두번째 진입 손절2(30),익절2(50),tr2(40) 했을때 b1, b2 모두 bl1,bp1,btr1 적용됨 2.두번째 진입에 사용할 피라미밍2 조건 수식이 없습니다. ********************************************************************************** 안녕하세요 예스스탁입니다. input : ntime(090000),n(1); input : 고가갱신수(20); input : uppyra검증(1.20); input : 상승pyra(0.20),상승N(12); input : up손절1(99999),up익절1(99999),upTR1(99999); input : up손절2(99999),up익절2(99999),upTR2(99999); var : BE1(0),BH1(0),BV1(0),BXcond1(false); var : BE2(0),BH2(0),BV2(0),BXcond2(false); if stime == ntime or (stime > ntime and stime[1] < ntime) Then{ if MaxEntries < n Then buy("b1"); } if MarketPosition == 1 and C >= EntryPrice+uppyra검증 and MaxContracts < 상승N Then buy("bb",AtStop,LatestEntryPrice(0)+상승Pyra); if MarketPosition == 0 and #현재무포지션이고 EntryDate(1) == sdate and #직전거래가 오늘 발생한 거래이고 MarketPosition(1) == 1 and #직전거래가 매수거래이고 countif(DayHigh(0) != DayHigh(0)[1],BarsSinceExit(1)) >= 고가갱신수 Then #청산이후 당일고가 갱신이 n회이상 있었으면 buy("b2"); if MarketPosition == 1 then { if CurrentContracts > CurrentContracts[1] Then { if MaxEntries == 1 then { BE1 = LatestEntryPrice(0); Bh1 = h; Bv1 = CurrentContracts-CurrentContracts[1]; BXcond1 = false; } if MaxEntries == 2 then { BE2 = LatestEntryPrice(0); Bh2 = h; Bv2 = CurrentContracts-CurrentContracts[1]; BXcond2 = false; } } if CurrentContracts < CurrentContracts[1] then { if LatestExitName(0) == "bl1" or LatestExitName(0) == "bp1" or LatestExitName(0) == "btr1" Then BXcond1 = true; if LatestExitName(0) == "bl2" or LatestExitName(0) == "bp2" or LatestExitName(0) == "btr2" Then BXcond2 = true; } if MaxEntries >= 1 then { if h > Bh1 Then Bh1 = h; if BXcond1 == false Then { ExitLong("bl1",AtStop,BE1-PriceScale*up손절1,"",BV1,1); ExitLong("bp1",Atlimit,BE1+PriceScale*up익절1,"",BV1,1); ExitLong("btr1",AtStop,Bh1-PriceScale*upTR1,"",BV1,1); } } if MaxEntries >= 2 then { if h > Bh2 Then Bh2 = h; if BXcond2 == false Then { ExitLong("bl2",AtStop,BE2-PriceScale*up손절2,"",BV2,1); ExitLong("bp2",Atlimit,BE2+PriceScale*up익절2,"",BV2,1); ExitLong("btr2",AtStop,Bh2-PriceScale*upTR2,"",BV2,1); } } } else { Bxcond1 = false; Bxcond2 = false; } 즐거운 하루되세요 > 목마와숙녀 님이 쓴 글입니다. > 제목 : 문의 > 아래수식의 손절,익절,TR,피라미딩은 1차 진입과 2차 진입에 공통으로 적용됩니다. 손절,익절,TR,피라미딩을 첫번째 진입과 두번째 진입에 각각 구분하여 적용하고 싶습니다. ************************************************************************************* input : ntime(090000),n(1); input : 고가갱신수(20); input : uppyra검증(1.20); input : 상승pyra(0.20),상승N(12); input : up손절(99999),up익절(99999),upTR(99999); if stime == ntime or (stime > ntime and stime[1] < ntime) Then{ if MaxEntries < n Then buy("b1"); } if MarketPosition == 1 and C >= EntryPrice+uppyra검증 and MaxContracts < 상승N Then buy("bb",AtStop,LatestEntryPrice(0)+상승Pyra); if MarketPosition == 0 and #현재무포지션이고 EntryDate(1) == sdate and #직전거래가 오늘 발생한 거래이고 MarketPosition(1) == 1 and #직전거래가 매수거래이고 countif(DayHigh(0) != DayHigh(0)[1],BarsSinceExit(1)) >= 고가갱신수 Then #청산이후 당일고가 갱신이 n회이상 있었으면 buy("b2"); if MarketPosition == 1 then { ExitLong("bl1",AtStop,EntryPrice-PriceScale*up손절); ExitLong("bp1",Atlimit,EntryPrice+PriceScale*up익절); ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*upTR); }