답변완료
수식 부탁드립니다
input : 익절(400),손절(100),k(40),k1(40); Buy("b1",AtStop,NextBarOpen+PriceScale*k); Sell("s1",AtStop,NextBarOpen-PriceScale*k1);SetStopProfittarget(익절,PointStop);SetStopLoss(손절,PointStop);위 수식을 30분봉에서 일일 매도,매수 각한번씩만 거래되게 수식 부탁드립니다
답변완료
문의
아래수식은익절 1 또는 익절2가 발생하면 그 다음 진입은 익절1 또는 익절2를 돌파하면 진입해달는 요청에 답변을 주신 수식입니다.수식을 확인해 보니 익절 1 이후 첫번째 진입하는 경우만 익절 1을 돌파하면 진입하고 두번째나 세번째 진입은 익절1 가격을 돌파하지 않아도 진입하는 현상이 발생합니다. 두번째나 세번째 진입도 익절1을 돌파할 때만 진입이 가능한 수식으로 수정바랍니다. 익절 2 이후 첫번째 진입하는 경우만 익절 2를 돌파하면 진입하고 두번째나 세번째 진입은 익절2 가격을 돌파하지 않아도 진입하는 현상이 발생합니다. 두번째나 세번째 진입도 익절2를 돌파할 때만 진입이 가능한 수식으로 수정바랍니다. 한마디로 익절이하에서는 진입하지 않는 수식을 원합니다.수식은 진입과정에서 익절1 (b1)은 한 번만 발생하고 익절2(b2)는 반복해서 발생합니다.일단 익절1이 발생하면 익절1 이상에서만 진입하고, 그 후 익절2가 발생하면 익절2 이상에서만 진입하길 원합니다.수식 수정 부탁드립니다.항상 고맙습니다.*************************************************************************************************************************input : 진입시간(084500),진입제한시간(150000);input : 거래횟수(5),누적패수(5),연속패수(3),누적패수조정(4);input : b1(1),진입눌림1(2),진입돌파1(3);input : b2(2),진입눌림2(3),진입돌파2(4);input : als(550),atr1(0),atr2(315);input : bls(480),btr1(0),btr2(730);input : b1lock(120000),익절1(330);input : b2lock(140000),익절2(590);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),익절가(0);//영업일변경if bdate != bdate[1] Then{ //손실횟수 초기화 0 loss = 0; //연속손실횟수 초기화 0 consecLoss = 0; //패수는 누적패수 패수 = 누적패수; //익절1이나 익절2가 발생하면 청산가격 저장할 변수 익절가 = 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; //청산 시 익절1이나 익절2이면 익절가에 청산가격 저장 if IsExitName("익절1",1) == true or IsExitName("익절2",1) == true Then 익절가 = ExitPrice(1); Else // 아니면 익절가 = 0; //익절가는 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 loss < 누적패수 and E1 == 2 and index > i1 and C >= S1+PriceScale*진입돌파2 and Tcond == true and (익절가 == 0 or (익절가 > 0 and C > 익절가)) Then //익절가가 0이거나 익절가가 0보다크면 종가가 익절가보다 커야 함 { buy("b2"); } } } if MarketPosition== 1 Then{ if IsEntryName("b1") == true Then { SetStopLoss(als,PointStop); SetStopTrailing(atr2,atr1,PointStop,1); } Else if IsEntryName("b2") == true Then { SetStopLoss(bls,PointStop); SetStopTrailing(btr2,btr1,PointStop,1); } Else { SetStopLoss(0); SetStopTrailing(0,0); }}if marketposition() == 1 and IsEntryName("b1") == true and stime<b1lock Then ExitLong("익절1",Atlimit,EntryPrice+익절1);if marketposition() == 1 and IsEntryName("b2") == true and stime<b2lock Then ExitLong("익절2",Atlimit,EntryPrice+익절2);SetStopEndofday(151500);
답변완료
종목검색식 부탁드립니다
아래수식의 변환을 부탁드립니다$$$$$$$$$$$$$$$$$$$$$$$$$$$$$HH=Highest(H,기간);LL=Lowest(L,기간);Mid=(HH+LL)/2;Hs=(HH+Mid)/2;Ls=(LL+Mid)/2;Hv=sum(if(C>=Hs,V,0),기간);Lv=sum(if(C<=Ls,V,0),기간);Mv=sum(if(C>Ls && C<Hs,V,0),기간);Maxv=Max(Hv,Mv,Lv);S1=if(Maxv==Hv,Hs,if(Maxv==Mv,Mid,Ls)); // 기간(20)CrossUp(C,S1)감사합니다
답변완료
아래의 트레이디이뷰 수식을 변환부탁드립니다.
//@version=6indicator("Trend Filter (2-pole) [BigBeluga]", overlay = true)// INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{int length = input.int(20, "Length")float damping = input.float(0.9, "Damping", minval = 0.1, maxval = 1.0, step = 0.01)int ris_fal = input.int(5, "Rising and Falling")float bands = input.float(1.0, "Bands", step = 0.1, minval = 0.5)color up_col = input.color(color.lime, "↑", inline = "color")color dn_col = input.color(color.red, "↓", inline = "color")color __col = input.color(color.yellow, "〜", inline = "color")bool bar_col = input.bool(false, "BarColor", inline = "Features")bool signals = input.bool(false, "Signals", inline = "Features")// }// CALCULATIONS――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{atr = ta.atr(200) * bands//@function Two-pole filter//@param src (series float) Source data (e.g., price)//@param length (float) Length of the filter (higher value means smoother output)//@param damping (float) Damping factor for the filter//@returns (series float) Filtered valuemethod two_pole_filter(float src, int length, float damping) => // Calculate filter coefficients float omega = 2.0 * math.pi / length float alpha = damping * omega float beta = math.pow(omega, 2) // Initialize the filter variables var float f1 = na var float f2 = na // Update the filter f1 := nz(f1[1]) + alpha * (src - nz(f1[1])) f2 := nz(f2[1]) + beta * (f1 - nz(f2[1])) f2tp_f = close.two_pole_filter(length, damping)var rising = 0var falling = 0up = tp_f > tp_f[2]dn = tp_f < tp_f[2]if up rising += 1 falling := 0if dn rising := 0 falling += 1color = up ? color.from_gradient(rising, 0, 15, __col, up_col) : dn ? color.from_gradient(falling, 0, 15, __col, dn_col) : __col// }// PLOT ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{plot(tp_f, "Two-Pole Filter", color = color, linewidth = 3)plotshape(falling >= ris_fal ? tp_f + atr : na, "Falling", shape.circle, location.absolute, color = color)plotshape(rising >= ris_fal ? tp_f - atr : na, "Rising", shape.circle, location.absolute, color = color)bool sig_up = ta.crossover(rising, ris_fal) and barstate.isconfirmed and signalsbool sig_dn = ta.crossover(falling, ris_fal) and barstate.isconfirmed and signalsplotshape(sig_dn ? tp_f[1] + atr : na, "Falling", shape.triangledown, location.absolute, color = color, size = size.tiny, offset = -1)plotshape(sig_up ? tp_f[1] - atr : na, "Rising", shape.triangleup, location.absolute, color = color, size = size.tiny, offset = -1)barcolor(bar_col ? color : na)// }
답변완료
문의 드립니다.
늘~~ 도움에 감사드립니다.종목 검출이 되지 않아다음 수식에 무슨 문제가 있는 건지 궁금합니다.원본아래의 수식을 종목검색식으로 부탁드림니다.TEMA50 상승이 TEMA50 하락을 돌파 종목검색식을 부탁 드립니다.input : len(20); var : A(0),Ema1(0),Ema2(0),Ema3(0),B(0); A=wma(2*WMa(c,len/2) - WMa(c,len), floor(sqrt(len))); Plot1(A,"HMA 상승"); if A[1] > A Then var2 = A; Plot2(var2,"HMA 하락"); EMA1=Ema(c,50); EMA2=Ema(EMA1,50); EMA3=Ema(EMA2,50); B = 3*EMA1-3*EMA2+EMA3; plot3(B,"TEMA 상승"); if B[1] > B Then var4 = B; plot4(var4,"TEMA 하락");변환본var : Ema1(0),Ema2(0),Ema3(0),B(0);EMA1=Ema(c,50); EMA2=Ema(EMA1,50); EMA3=Ema(EMA2,50); B = 3*EMA1-3*EMA2+EMA3; if CrossUp(B,var4) Then Find(1);