커뮤니티

예스랭귀지 Q&A

글쓰기
답변완료

지표재요청부탁드립니다

안녕하세요 관리자님!! 제가 설명을 부족하게 해드린거 같아서 다시한번 말씀올립니다. 볼밴과 같은 상한,하한선을 구하려고 하는데요 1.전일분봉차트에서 전일시가 위에 존재하는 봉의 갯수가 만약 n개라 가정할때 1)상한1= [(고가1-전일시가)+(고가2-전일시가)+....(고가n-전일시가)]/n + dayopen(0) 2)하한1: [(저가1-전일시가)+(저가2-전일시가)+....(저가n-전일시가)]/n + dayopen(0) 2.전일분봉차트에서 시가 아래에 존재하는 봉의 갯수가 만약 n개라 가정할때 1)상한2: [(전일시가-고가1)+(전일시가-고가2)+....(전일시가-고가n)]/n + dayopen(0) 2)하한2: [(전일시가-저가1)+(전일시가-저가2)+....(전일시가-저가n)]/n + dayopen(0)
프로필 이미지
카카
2020-04-08
1098
글번호 137728
지표
답변완료

지표수식 전환부탁

다음 수식을 시스템 수식으로 전환부탁드립니다. <1> // Inputs len = input(21, title="Length") dr = roc(close,1)/sma(close,2) lowVol = input(0.15) bton(b) => b ? 1 : 0 // Logic volaSD = stdev(dr,len) runningVola = 0 for i = 1 to len-1 runningVola := runningVola + bton(volaSD[i] <= volaSD) vswitch = (runningVola + 1)/len // View hline(.15, title='Pi', color=color.maroon, linestyle=hline.style_dotted, linewidth=1) plot(vswitch, style=plot.style_columns, color=(vswitch<0.15)?color.red:color.gray,transp=0) // END <2> length = input(20) mult = input(2) atr_ = atr(length) max1 = max(nz(max_[1]), close) min1 = min(nz(min_[1]), close) is_uptrend_prev = nz(is_uptrend[1], true) stop = is_uptrend_prev ? max1 - mult * atr_ : min1 + mult * atr_ vstop_prev = nz(vstop[1]) vstop1 = is_uptrend_prev ? max(vstop_prev, stop) : min(vstop_prev, stop) is_uptrend = close - vstop1 >= 0 is_trend_changed = is_uptrend != is_uptrend_prev max_ = is_trend_changed ? close : max1 min_ = is_trend_changed ? close : min1 vstop = is_trend_changed ? is_uptrend ? max_ - mult * atr_ : min_ + mult * atr_ : vstop1 plot(vstop, color = is_uptrend ? green : red, style=line, linewidth=2)
프로필 이미지
이대표
2020-04-08
1046
글번호 137727
지표

생각하는허수아비 님에 의해서 삭제되었습니다.

프로필 이미지
생각하는허수아비
2020-04-08
2
글번호 137726
검색
답변완료

부탁 드립니다.

도움에 감사 드립니다. 질문1) 일봉에 사용하던 수식이 분봉(타주기)에서 나타 나도록 부탁 드립니다. 질문2) 예를 들어 60분봉에서 사용하던 지표가 10분봉(타분봉)에서 나타 나도록 부탁 드립니다. 미리 감사 드립니다. input : 단기이평p1(5),장기이평p2(60),sig(5); var:shrt(0),long(0),hsto(0),hsto2(0); shrt=ma(c,단기이평p1); long=ma(c,장기이평p2); hsto=shrt-long; hsto2=ma(hsto,sig); plot1(hsto2); PlotBaseLine1(0);
프로필 이미지
yes
2020-04-08
957
글번호 137725
지표
답변완료

문의드립니다.

1. xcolor = iff(pos == -1 ,red,iff(pos == 1 , green,blue)); plot1(xATRTrailingStop,"Trailing Stop",xcolor); 상기식에서 색상과 굵기를 속성창에서 조절가능하다면 부탁합니다. 혹,속성창에서 안된다면 굵기를 조절할수있게 부탁합니다. 2. 5일 이평과 20일이평의 골든크로스일때와 데드크로스일때를 막대그래프로 표현하고싶습니다. 골든일때 빨강, 데드일때 파랑으로 막대그래프로 표현할수있게 부탁합니다.
프로필 이미지
as8282
2020-04-09
914
글번호 137720
지표
답변완료

부탁드립니다.

항상 감사드립니다. 아래와 같이 ##카운트를 추가하고 싶습니다. 1) 전략창 전체의: [(StopTrailing 개수) / (StopLoss+StopTrailing) 개수] x100 2) 청산시점 포함하여 최근 20% 개수에 대한 : [(StopTrailing 개수) / (StopLoss+StopTrailing) 개수] x100 예_1 전체 청산 개수 20개(StopTrailing 10개, StopLoss 10개) 최근20% 청산개수 4개(StopTrailing 1개, StopLoss 3개) 1) 전체 개수(20개)= 11010101001010110001 --> 수식 : [10개/(10개+10개)]x100 = 50.0 2) 20% 개수(4개)= 0001 --> 수식 : [1개/(1개+3개)]x100 = 25.0 예_2 전체 청산 개수 25개(StopTrailing 13개, StopLoss 12개) 최근20% 청산개수 5개(StopTrailing 2개, StopLoss 3개) 1) 전체 개수(25개) = 1101011010101001010110001 --> 수식 : [13/(13+12)]x100 = 52.0 2) 20% 개수(5개) = 10001 --> 수식 : [2/(2+3)]x100 = 40.0 (StopTrailing:1, StopLoss:0로 표현) 1),2)를 텍스트 표시하고 싶습니다. 텍스트는 1)이 위 2)는 아래에 위치하게 부탁드립니다. 1)값(위) 2)값(아래) 값은 소수 한자리 수까지 표현 부탁드립니다. input : 손절(20),익절(15),익절하락(3); input : P1(30), P2(120), p3(240); input : StartTime(090000),EndTime(050000); var : tt(0),tx(0),X(false); var: Tcond(false),ht(0); var1 = ma(C, P1); var2 = ma(C, P2); var3 = ma(C, P3); if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; tt = 0; X = false; } if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then { Tcond = false; if MarketPosition == 1 Then { ExitLong("BE6"); } if MarketPosition == -1 Then { ExitShort("SE6"); } } if Tcond == true then { if marketposition == 0 and crossup(var1,var2) Then { buy("B1"); } if marketposition == 0 and crossdown(var1,var2) Then { sell("S1"); } if marketposition == 0 and crossup(var2,var3) and var3[1] < var3 Then { buy("B2"); } if marketposition == 0 and crossdown(var3,var4) and var3[1] > var3 Then { sell("S2"); } ## 청산 if MarketPosition == 1 then { SetStopTrailing(익절하락,익절,PointStop); SetStopLoss(손절,PointStop); } if MarketPosition == -1 Then { SetStopTrailing(익절하락,익절,PointStop); SetStopLoss(손절,PointStop); } } ## 카운트 (수정요청) if TotalTrades > TotalTrades[1] then { if IsExitName("StopLoss",1) == true then { tt = tt +1 ; if tt > ht Then { ht = tt; } Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(ht,0)+"◆"); Text_SetSize(tx,20); Text_Setstyle(tx,2,20); Text_SetColor(tx,GREEN); } } if IsExitName("StopTrailing",1) == true then { tt = tt + 1; ht = tt; } Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(ht,0)+"◆"); Text_SetSize(tx,20); Text_Setstyle(tx,2,20); Text_SetColor(tx,GREEN); } } }
프로필 이미지
라떼처럼
2020-04-09
980
글번호 137715
시스템
답변완료

문의드립니다.

66867 관련하여 답변주셔서 감사드립니다. 답변 주신 변환식에 plot(Signal_Line, title = "Signal", color = color.gray, style = plot.style_line) 을 추가하고 싶습니다. plot3(Signal_Line,"Signal", GRAY); 로 단순히 추가 작성하여 컴파일 시켜보았지만 적용이 원래대로 되지 않습니다. 추가 수정 문의드립니다. 감사합니다. ------------------------------------------------------------------------------ (기존 답변 문의드렸던 수식입니다.) > //@version=4 study(BB MACD) inp_Source = input(title = "Source", type = input.source, defval = close) inp_Sensitivity = input(title = "Sensitivity", type = input.float, defval = 0.01) inp_HiLo_Lookback = input(title = "Hi/Lo Lookback", type = input.integer, defval = 5) inp_Slow_MA_Period = input(title = "Slow MA: Period", type = input.integer, defval = 26) inp_Slow_MA_Method = input(title = "Slow MA: Type", defval = 'EMA', options = ['SMA', 'EMA', 'LWMA', 'RMA']) inp_Fast_MA_Period = input(title = "Fast MA: Period", type = input.integer, defval = 12) inp_Fast_MA_Method = input(title = "Fast MA: Type", defval = 'EMA', options = ['SMA', 'EMA', 'LWMA', 'RMA']) inp_Signal_MA_Period = input(title = "Signal MA: Period", type = input.integer, defval = 9) inp_Signal_MA_Method = input(title = "Signal MA: Type", defval = 'SMA', options = ['SMA', 'EMA', 'WMA', 'RMA']) f_Get_MA(MA_Type, MA_Source, MA_Period) => MA = 0.0 MA := MA_Type == 'SMA' ? sma(MA_Source, MA_Period) : MA_Type == 'EMA' ? ema(MA_Source, MA_Period) : MA_Type == 'WMA' ? wma(MA_Source, MA_Period) : MA_Type == 'RMA' ? rma(MA_Source, MA_Period) : na MA f_Get_Std_Dev(MA_Type, MA_Source, MA_Period) => MA = 0.0 MA := f_Get_MA(MA_Type, MA_Source, MA_Period) Price = 0.0 Price := sma(MA_Source, 1) Summation = 0.0 for i = 0 to MA_Period - 1 Summation := Summation + (Price[i] - MA) * (Price[i] - MA) Std_Dev = 0.0 Std_Dev := sqrt(Summation / MA_Period) Std_Dev f_Get_TR() => TR = max(high, close[1]) - min(low, close[1]) TR f_Get_ATR(Period) => TR = f_Get_TR() Summation = 0.0 for i = 1 to Period Summation := Summation + TR[i] ATR = 0.0 ATR := Summation / Period ATR MA_Fast = f_Get_MA(inp_Fast_MA_Method, inp_Source, inp_Fast_MA_Period) HiLo_Range = abs(barssince(high == highest(high, inp_HiLo_Lookback)) - barssince(low == lowest(low, inp_HiLo_Lookback))) * syminfo.mintick * 100000 MA_Slow = f_Get_MA(inp_Slow_MA_Method, inp_Source, inp_Slow_MA_Period) MA_Slow_Deviation = f_Get_Std_Dev(inp_Slow_MA_Method, inp_Source, inp_Slow_MA_Period) MA_Slow_ATR = f_Get_ATR(inp_Slow_MA_Period) Histogrm = MA_Slow_Deviation - MA_Slow_ATR Main_Line = Histogrm Signal_Line = f_Get_MA(inp_Signal_MA_Method, Main_Line, inp_Signal_MA_Period) Histogrm_Color = color.green if MA_Fast >= MA_Fast[1] if HiLo_Range >= inp_Sensitivity Histogrm_Color := color.green else Histogrm_Color := color.yellow else if HiLo_Range >= inp_Sensitivity Histogrm_Color := color.red else Histogrm_Color := color.blue plot(Histogrm, title = "BB MACD", color = Histogrm_Color, style = plot.style_histogram) plot(Histogrm, title = "BB MACD", color = color.blue, style = plot.style_line) plot(Signal_Line, title = "Signal", color = color.gray, style = plot.style_line)
프로필 이미지
로즈버드
2020-04-08
1193
글번호 137712
지표
답변완료

누적패수

누적패수 3회까지만 거래하는 조건 부탁합니다. ******************************************************************************* Input : Period1(74),Period2(12); Var : 매수이평(0), 매도이평(0); 매수이평 = ma(bids, period1); 매도이평 = ma(asks, period2); if crossup(매수이평, 매도이평) then buy();
프로필 이미지
좌오비우오비
2020-04-08
1078
글번호 137710
시스템
답변완료

시스템 트레이딩에 적용할 매수, 매도 수식 작성요청

언제나 노고가 많으신 관계자 분들께 항상 감사드립니다. 분봉챠트 및 틱봉챠트에 적용할 아래의 시스템매매 수식 작성을 부탁드립니다. <매수조건> 현재 캔들이 당일의 고가와 저가의 평균가 이상으로 양봉마감시 다음 캔들 시가에서 매수. <메도조건> 현재 캔들이 당일의 고가와 저가의 평균가 이하로 음봉마감시 다음 캔들 시가에서 매도. 감사합니다.
프로필 이미지
딸라벌이
2020-04-08
1011
글번호 137709
시스템

레전드 님에 의해서 삭제되었습니다.

프로필 이미지
레전드
2020-04-08
4
글번호 137708
지표