답변완료
시스템 수식 검증
아래 수식 들을 검증 부탁 드립니다.특히 중괄호 부분들이 잘 되어 있는지 검토 부탁드립니다.[수식1]input : 시작일(20260101),시작시간(090000);input : 이평1(180),이평2(15);input : 윌리엄스R기간값(14);input : 손절틱수(100),목표틱수(200),트레일링스탑틱수(100);var : mav1(0),WR(0);if sdate >= 시작일 and sTime >= 시작시간 Then{Condition1 = true;Condition2 = true;}MAV1 = MA(c,이평1);WR = WILLR(윌리엄스R기간값);if TotalTrades > TotalTrades and IsExitName("StopLoss",1) ==true ThenCondition2 = False;if Condition1 == true and Condition2 == true Then{if MarketPosition == 0 and c < mav1 and CrossDown(WR, -20) ThenSell("s");if MarketPosition == -1 Then{if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*목표틱수 ThenExitShort("str",AtStop,EntryPrice-PriceScale*트레일링스탑틱수);}SetStopLoss(PriceScale*손절틱수,PointStop);}[수식2]input : 시작일(20260101),시작시간(090000);input : 이평1(180),이평2(15);input : 윌리엄스R기간값(14);input : 손절틱수(100),목표틱수(200),트레일링스탑틱수(100);var : mav1(0),WR(0);if sdate >= 시작일 and sTime >= 시작시간 Then{Condition1 = true;Condition2 = true;}MAV1 = MA(c,이평1);WR = WILLR(윌리엄스R기간값);if TotalTrades > TotalTrades and IsExitName("StopLoss",1) ==true ThenCondition2 = False;if Condition1 == true and Condition2 == true Then{if MarketPosition == 0 and c > mav1 and CrossUP(WR, -80) ThenBuy("b");if MarketPosition == 1 Then{if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*목표틱수 Then ExitLong("btr",AtStop,EntryPrice+PriceScale*트레일링스탑틱수); }SetStopLoss(PriceScale*손절틱수,PointStop);}[수식3]input : 시작일(20260101),시작시간(090000);input : 이평1(30);input : 윌리엄스R기간값(90);input : 손절틱수(140),청산틱수(240);var : mav1(0),WR(0);if sdate >= 시작일 and sTime >= 시작시간 Then{ Condition1 = true; Condition2 = true;}MAV1 = MA(c,이평1);WR = WILLR(윌리엄스R기간값);if TotalTrades > TotalTrades and IsExitName("StopLoss",1) ==true Then Condition2 = False;if Condition1 == true and Condition2 == true Then{ if MarketPosition == 0 and CrossUP(WR, -80) Then Buy("b"); if MarketPosition == 1 Then { if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*청산틱수 Then if CrossDown(C,mav1) Then ExitLong("bx"); } SetStopLoss(PriceScale*손절틱수,PointStop);}[수식4]input : 시작일(20260101),시작시간(090000);input : 이평1(30);input : 윌리엄스R기간값(90);input : 손절틱수(140),청산틱수(240);var : mav1(0),WR(0);if sdate >= 시작일 and sTime >= 시작시간 Then{ Condition1 = true; Condition2 = true;}MAV1 = MA(c,이평1);WR = WILLR(윌리엄스R기간값);if TotalTrades > TotalTrades and IsExitName("StopLoss",1) ==true Then Condition2 = False;if Condition1 == true and Condition2 == true Then{ if MarketPosition == 0 and CrossDown(WR, -20) Then Sell("s");}if MarketPosition == -1 Then{ if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*청산틱수 Then if CrossUp(C,mav1) Then ExitShort("sx"); }SetStopLoss(PriceScale*손절틱수,PointStop);[수식5]input : 시작일(20251101),시작시간(090000);input : 이평1(30),이평2(240);input : 손절틱수(150),청산틱수(300);var : mav1(0),mav2(0);if sdate >= 시작일 and sTime >= 시작시간 Then{Condition1 = true;Condition2 = true;}MAV1 = MA(c,이평1);MAV2 = MA(c,이평2);if TotalTrades > TotalTrades and IsExitName("StopLoss",1) ==true ThenCondition2 = False;if Condition1 == true and Condition2 == true Then{if MarketPosition == 0 and CrossDown(c, mav1) ThenSell("s");if MarketPosition == 1 Then{if highest(H,BarsSinceEntry) <= EntryPrice+PriceScale*청산틱수 Thenif CrossDown(C,mav2) ThenExitLong("sx"); } SetStopLoss(PriceScale*손절틱수,PointStop);}[수식6]input : 시작일(20251101),시작시간(090000);input : 이평1(30),이평2(240);input : 손절틱수(150),청산틱수(300);var : mav1(0),mav2(0);if sdate >= 시작일 and sTime >= 시작시간 Then{Condition1 = true;Condition2 = true;}MAV1 = MA(c,이평1);MAV2 = MA(c,이평2);if TotalTrades > TotalTrades and IsExitName("StopLoss",1) ==true ThenCondition2 = False;if Condition1 == true and Condition2 == true Then{if MarketPosition == 0 and CrossUp(c, mav1) ThenBuy("b");if MarketPosition == 1 Then{if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*청산틱수 Thenif CrossDown(C,mav2) ThenExitLong("bx"); } SetStopLoss(PriceScale*손절틱수,PointStop);}[수식7]input : 시작일(20260101),시작시간(090000);input : 이평1(180),이평2(15);input : 윌리엄스R기간값(14);input : 손절틱수(100),목표틱수(200),트레일링스탑틱수(100);var : mav1(0),WR(0);if sdate >= 시작일 and sTime >= 시작시간 Then{Condition1 = true;Condition2 = true;}MAV1 = MA(c,이평1);WR = WILLR(윌리엄스R기간값);if TotalTrades > TotalTrades and IsExitName("StopLoss",1) ==true ThenCondition2 = False;if Condition1 == true and Condition2 == true Then{if MarketPosition == 0 and c < mav1 and CrossDown(WR, -20) ThenSell("s");if MarketPosition == -1 Then{if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*목표틱수 ThenExitShort("str",AtStop,EntryPrice-PriceScale*트레일링스탑틱수);}SetStopLoss(PriceScale*손절틱수,PointStop);}[수식8]input : 시작일(20260101),시작시간(090000);input : 이평1(180),이평2(15);input : 윌리엄스R기간값(14);input : 손절틱수(100),목표틱수(200),트레일링스탑틱수(100);var : mav1(0),WR(0);if sdate >= 시작일 and sTime >= 시작시간 Then{Condition1 = true;Condition2 = true;}MAV1 = MA(c,이평1);WR = WILLR(윌리엄스R기간값);if TotalTrades > TotalTrades and IsExitName("StopLoss",1) ==true ThenCondition2 = False;if Condition1 == true and Condition2 == true Then{if MarketPosition == 0 and c > mav1 and CrossUP(WR, -80) ThenBuy("b");if MarketPosition == 1 Then{if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*목표틱수 Then ExitLong("btr",AtStop,EntryPrice+PriceScale*트레일링스탑틱수); }SetStopLoss(PriceScale*손절틱수,PointStop);}이상입니다.수고하세요..
답변완료
경과봉 조정
아래수식은 국내지수선물데이트레이딩 수식입니다.진입명 b1,b2로 2회 거래합니다.요청사항b2진입시 경과봉 필터가 있습니다.이 경과봉에 조건을 하나 추가하고 싶습니다.기존 경과봉은 그대로 수행됩니다.단, b1이 트레일링스탑으로 포지션이 청산되었을 경우b2의 기존 경과봉이 새로운 경과봉으로 조정되는 수식입니다.ex)input : 경과봉(150), 조정경과봉(200),b2(1),진입눌림2(0),진입돌파2(0);항상 고맙습니다.****************************************************************************************************************************input : 진입시간(084500),진입제한시간(150000);input : 거래횟수(2),누적패수(2),연속패수(2),누적패수조정(2);input : b1(1),진입눌림1(0),진입돌파1(0);input : 경과봉(150),b2(1),진입눌림2(0),진입돌파2(0);input : als(21),atr1(0),atr2(999999);input : bls(40),btr1(0),btr2(999999);var : T1(0),entry(0),LL(0),EH(0),E1(0),H1(0),i1(0),S1(0),L1(0),V1(0);var : Tcond(false);var : loss(0),consecLoss(0),패수(0);//영업일변경if bdate != bdate[1] Then{//손실횟수 초기화 0loss = 0;//연속손실횟수 초기화 0consecLoss = 0;//패수는 누적패수패수 = 누적패수;}//청산발생if TotalTrades > TotalTrades[1] Then{//손실이면if PositionProfit(1) < 0 Then{//loss 1씩 증가loss = loss+1;//consecLoss 1씩 증가consecLoss = consecLoss+1;//consecLoss이 3이면 패수를 누적패수에서 누적패수조정으로 변경if consecLoss == 연속패수 Then{패수 = 누적패수조정;}}Else //손실이 아니면 consecLoss으로 초기화consecLoss = 0;}if (sdate != sdate[1] and stime >= 진입시간) or (sdate == sdate[1] and stime >= 진입시간 and stime[1] < 진입시간) Then Tcond = true; if (sdate != sdate[1] and stime >= 진입제한시간) or (sdate == sdate[1] and stime >= 진입제한시간 and stime[1] < 진입제한시간) Then Tcond = false; if (sdate != sdate[1] and stime >= 진입시간) or (sdate == sdate[1] and stime >= 진입시간 and stime[1] < 진입시간) Then{ T1 = TotalTrades; E1 = 0; LL = L;}if stime >= 진입시간 then{ if L < LL Then LL = L; if MarketPosition == 0 Then entry = TotalTrades-T1; Else entry = (TotalTrades-T1)+1; if MarketPosition == 0 and entry == 0 Then{ if E1 == 0 and C >= LL+PriceScale*B1 Then{ E1 = 1; H1 = H; i1 = index; V1 = LL; //시작점 종가 } if E1 == 1 and index > i1 then{ if H > H1 Then H1 = H; #저가가 시작봉종가보다 클때만 눌림체크 if L >= V1 and L <= H1-PriceScale*진입눌림1 Then{ E1 = 2; i1 = index; S1 = H1; } } //시작점 종가보다 낮은 가격이 발생하면 초기화 if E1 >= 1 and L < V1 Then{ E1 = 0; LL = L; } if loss < 패수 and E1 == 2 and index > i1 and C >= S1+PriceScale*진입돌파1 and Tcond == true Then{ buy("b1"); } } if TotalTrades > TotalTrades[1] Then{ E1 = 0; LL = L; } if L < LL Then LL = L; if MarketPosition == 0 and entry >= 1 and entry < 거래횟수 Then{ if E1 == 0 and C >= LL+PriceScale*B2 Then{ E1 = 1; H1 = H; i1 = index; V1 = LL; //시작점 종가 } if E1 == 1 and index > i1 then{ if H > H1 Then H1 = H; #저가가 시작봉종가보다 클때만 눌림체크 if L >= V1 and L <= H1-PriceScale*진입눌림2 Then{ E1 = 2; i1 = index; S1 = H1; } } //시작점 종가보다 낮은 가격이 발생하면 초기화 if E1 >= 1 and L < V1 Then{ E1 = 0; LL = L; } if loss < 패수 and (TotalTrades == 0 or (TotalTrades >= 1 and BarsSinceExit(1) > 경과봉)) and loss < 누적패수 and E1 == 2 and index > i1 and C >= S1+PriceScale*진입돌파2 and Tcond == true Then{ buy("b2"); } }}if MarketPosition== 1 Then{ if IsEntryName("b1") == true Then { SetStopLoss(PriceScale*als,PointStop); SetStopTrailing(PriceScale*atr2,PriceScale*atr1,PointStop,1); } Else if IsEntryName("b2") == true Then { SetStopLoss(PriceScale*bls,PointStop); SetStopTrailing(PriceScale*btr2,PriceScale*btr1,PointStop,1); } Else { SetStopLoss(0);SetStopTrailing(0,0); }}
답변완료
수정을 부탁드립니다.
안녕하세요?아래 수식중 Plot1, Plot17 "당일매수거래량을 0을 기준으로 RGB를 표기하도록 되어있는데요이것을 피보나티비울 50% 기준으로 추가하거나 수정해 주세요늘 도와주심에 감사드립니다.오늘 남은시간도 즐거운시간되세요===========================input : Change(500), 캔들수(-12);var : HH(0),LL(0);var : HD(0),HT(0),HV(0);var : LD(0),LT(0),LV(0);var : UpTrend(false),DownTrend(False),Trend(0);var : TX1(0),TX2(0),TX3(0),TX4(0);if Bdate != Bdate[1] Then{ var1 = 0; Var2 = Upvol-DownVol;}var1 = var1 + (Upvol-DownVol);if Bdate != Bdate[1] Then{ HD = sDate; HT = sTime; HV = var1; LD = sDate; LT = sTime; LV = var1; trend = 0; if CurrentDate == sDate Then { tx1 = Text_New_Self(HD,HT,HV,"----------------"); Text_SetStyle(tx1,2,0); Text_SetColor(tx1,Magenta); tx3 = Text_New(HD,HT,H,"고----------------"); Text_SetStyle(tx3,2,0); Text_SetColor(tx3,Magenta); tx2 = Text_New_Self(LD,LT,LV,"----------------"); Text_SetStyle(tx2,2,0); Text_SetColor(tx2,blue); tx4 = Text_New(LD,LT,L,"저----------------"); Text_SetStyle(tx4,2,0); Text_SetColor(tx4,blue); } hh = var1; ll = var1;}Else{ if var1 > hh Then hh = var1; if var1 < ll Then ll = var1; UpTrend = var1 >= LV[0]+Change; DownTrend = var1 <= HV[0]-Change; if trend <= 0 and UpTrend == true Then { trend = 1; HD = sDate; HT = sTime; HV = var1; if CurrentDate == sDate Then { tx1 = Text_New_Self(HD,HT,HV,"----------------"); Text_SetStyle(tx1,2,0); Text_SetColor(tx1,Magenta); tx3 = Text_New(HD,HT,H,"----------------"); Text_SetStyle(tx3,2,0); Text_SetColor(tx3,Magenta); } } Else if trend >= 0 and DownTrend Then { trend = -1; LD = sDate; LT = sTime; LV = var1; if CurrentDate == sDate Then { tx2 = Text_New_Self(LD,LT,LV,"----------------"); Text_SetStyle(tx2,2,0); Text_SetColor(tx2,blue); tx4 = Text_New(LD,LT,L,"----------------"); Text_SetStyle(tx4,2,0); Text_SetColor(tx4,blue); } } Else { if trend == 1 Then { if var1 > HV Then { HD = sDate; HT = sTime; HV = var1; if CurrentDate == sDate Then { Text_SetLocation(TX1,HD,HT,HV); Text_SetLocation(TX3,HD,HT,H); } } } if trend == -1 Then { if var1 < LV Then { LD = sDate; LT = sTime; LV = var1; if CurrentDate == sDate Then { Text_SetLocation(TX2,LD,LT,LV); Text_SetLocation(TX4,LD,LT,L); } } } if trend == 0 Then { if var1 > HV Then { HD = sDate; HT = sTime; HV = var1; if CurrentDate == sDate Then { Text_SetLocation(TX1,HD,HT,HV); Text_SetLocation(TX3,HD,HT,H); } } if var1 < LV Then { LD = sDate; LT = sTime; LV = var1; if CurrentDate == sDate Then { Text_SetLocation(TX2,LD,LT,LV); Text_SetLocation(TX4,LD,LT,L); } } } }} if CurrentDate == sDate Then{ Plot1(var1,"당일실매수거래량",iff(var1 > 0,RGB(200,0,0),RGB(0,0,0))); FixPlotShift(1,캔들수); Plot17(var1,"당일실매수거래량2",iff(var1 > 0,RGB(255,0,0),RGB(0,0,255))); Plot3(hh,"최고"); plot4(ll,"최저"); plot5(ll+(hh-ll)*0.25,"25.0%"); plot6(ll+(hh-ll)*0.382,"38.2%"); plot7(ll+(hh-ll)*0.500,"50.0%"); plot8(ll+(hh-ll)*0.505,"50.05%"); plot9(ll+(hh-ll)*0.515,"51.5%"); plot10(ll+(hh-ll)*0.495,"49.5%"); plot13(ll+(hh-ll)*0.485,"48.5%"); plot14(ll+(hh-ll)*0.618,"61.8%"); plot15(ll+(hh-ll)*0.75,"75.0%"); plot18(ll+(hh-ll)*0.125,"12.5%"); plot19(ll+(hh-ll)*0.875,"87.5%"); plot20(ll+(hh-ll)*0.127,"12.7%"); plot21(ll+(hh-ll)*0.877,"87.7%"); plot22(ll+(hh-ll)*0.755,"75.5%"); plot23(ll+(hh-ll)*0.255,"25.5%"); plot40((Var2/2),"첫봉종가50%");} if CurrentDate == sDate Then{ PlotBaseLine2(1000); PlotBaseLine3(500); PlotBaseLine4(100); } PlotBaseLine1(0);