커뮤니티

피라미딩별청산2

프로필 이미지
목마와숙녀
2023-04-24 09:37:10
1386
글번호 167458
답변완료

첨부 이미지

피라미딩 적용했을 때 a,b 진입 후 a는 xb1 b는 xb2로 청산하는 수식을 작성했는데 a,b 모두 xb1으로 청산됩니다. b는 xb2로 청산되게 수식 수정 부탁드립니다. ****************************************************************************** input:st1(101000),butd21(100),butd31(10000); input:st2(103000),butd22(2000),butd32(12500); input : exst(103000),ex하락1(99999),ex하락2(99999); var : T1(0),entry(0); if Bdate != Bdate[1] Then T1 = TotalTrades; if MarketPosition == 0 Then entry = TotalTrades-T1; Else entry = (TotalTrades-T1)+1; if MarketPosition == 0 and sTime>=st1 and entry==0 and !(data2(c<Highd(0)-butd21)) and !(data3(c>Lowd(0)+butd31)) Then Buy("a"); if MarketPosition == 1 then { if MaxEntries==1 and sTime>=st2 and entry==1 and !(data2(c<Highd(0)-butd22)) and !(data3(c>Lowd(0)+butd32)) Then Buy("b"); } var : Tcond(false,Data2),h2(0,Data2),L2(0,Data2); if Data2(Bdate != Bdate[1]) Then Tcond = False; if Data2((sdate != sdate[1] and stime >= exst) or (sdate == sdate[1] and stime >= exst and stime[1] < exst)) Then { Tcond = true; h2 = Data2(h); l2 = Data2(l); } if Tcond == true Then { if Data2(H) > h2 Then h2 = Data2(h); if Data2(L) < l2 Then l2 = Data2(l); if MarketPosition == 1 and IsEntryName("a") and data2(c<h2-ex하락1) then exitlong("xb1"); if MarketPosition == 1 and IsEntryName("b") and data2(c<h2-ex하락2) then exitlong("xb2"); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-03-23 14:13:08

안녕하세요 예스스탁입니다. IsEntryName 포지션의 첫진입명만 리턴합니다. 진입명 별로 각각 청산하고자 하시면 청산함수에 진입명을 지정하시면 됩니다. input:st1(101000),butd21(100),butd31(10000); input:st2(103000),butd22(2000),butd32(12500); input : exst(103000),ex하락1(99999),ex하락2(99999); var : T1(0),entry(0); if Bdate != Bdate[1] Then T1 = TotalTrades; if MarketPosition == 0 Then entry = TotalTrades-T1; Else entry = (TotalTrades-T1)+1; if MarketPosition == 0 and sTime>=st1 and entry==0 and !(data2(c<Highd(0)-butd21)) and !(data3(c>Lowd(0)+butd31)) Then Buy("a"); if MarketPosition == 1 then { if MaxEntries==1 and sTime>=st2 and entry==1 and !(data2(c<Highd(0)-butd22)) and !(data3(c>Lowd(0)+butd32)) Then Buy("b"); } var : Tcond(false,Data2),h2(0,Data2),L2(0,Data2); if Data2(Bdate != Bdate[1]) Then Tcond = False; if Data2((sdate != sdate[1] and stime >= exst) or (sdate == sdate[1] and stime >= exst and stime[1] < exst)) Then { Tcond = true; h2 = Data2(h); l2 = Data2(l); } if Tcond == true Then { if Data2(H) > h2 Then h2 = Data2(h); if Data2(L) < l2 Then l2 = Data2(l); if MarketPosition == 1 and data2(c<h2-ex하락1) then exitlong("xb1",OnClose,Def,"a"); if MarketPosition == 1 and data2(c<h2-ex하락2) then exitlong("xb2",OnClose,Def,"b"); } 즐거운 하루되세요 > 목마와숙녀 님이 쓴 글입니다. > 제목 : 문의 > 피라미딩 적용했을 때 a,b 진입 후 a는 xb1 b는 xb2로 청산하는 수식을 작성했는데 a,b 모두 xb1으로 청산됩니다. b는 xb2로 청산되게 수식 수정 부탁드립니다. ****************************************************************************** input:st1(101000),butd21(100),butd31(10000); input:st2(103000),butd22(2000),butd32(12500); input : exst(103000),ex하락1(99999),ex하락2(99999); var : T1(0),entry(0); if Bdate != Bdate[1] Then T1 = TotalTrades; if MarketPosition == 0 Then entry = TotalTrades-T1; Else entry = (TotalTrades-T1)+1; if MarketPosition == 0 and sTime>=st1 and entry==0 and !(data2(c<Highd(0)-butd21)) and !(data3(c>Lowd(0)+butd31)) Then Buy("a"); if MarketPosition == 1 then { if MaxEntries==1 and sTime>=st2 and entry==1 and !(data2(c<Highd(0)-butd22)) and !(data3(c>Lowd(0)+butd32)) Then Buy("b"); } var : Tcond(false,Data2),h2(0,Data2),L2(0,Data2); if Data2(Bdate != Bdate[1]) Then Tcond = False; if Data2((sdate != sdate[1] and stime >= exst) or (sdate == sdate[1] and stime >= exst and stime[1] < exst)) Then { Tcond = true; h2 = Data2(h); l2 = Data2(l); } if Tcond == true Then { if Data2(H) > h2 Then h2 = Data2(h); if Data2(L) < l2 Then l2 = Data2(l); if MarketPosition == 1 and IsEntryName("a") and data2(c<h2-ex하락1) then exitlong("xb1"); if MarketPosition == 1 and IsEntryName("b") and data2(c<h2-ex하락2) then exitlong("xb2"); }