답변완료
수식 의뢰 드립니다.
안녕하세요! 시스템 수식을 부탁드립니다.
아래 수식은 지난번에 만들어 주셔서 해선 매매에 활용하고 있습니다.
이해를 돕고져 첨부파일을 첨부합니다.
부탁드립니다!
#plot1만 막대로 지정하시면 됩니다.
#상승 보라, 하락 형광, 최고갱신 빨강, 최저갱신 파랑으로 표시됩니다.
#최고격차와 최저격차는 선으로 표시되고 각각 텍스트 출력됩니다.
var : diff(0,data1),hh(0,Data1),ll(0,Data1),clr(0,Data1),tx(0),Htx(0),Ltx(0);
diff = Data1(c)-Data2(c);
if Data1(Bdate != Bdate[1]) Then
{
hh = diff;
LL = diff;
if diff > diff[1] Then
clr = Magenta;
Else
clr = Cyan;
Htx = text_new_self(sDate,sTime,HH,NumToStr(HH,2));
Text_SetStyle(Htx,2,1);
Text_SetColor(Htx,Red);
Ltx = text_new_self(sDate,sTime,LL,NumToStr(LL,2));
Text_SetStyle(Ltx,2,1);
Text_SetColor(Ltx,Blue);
}
Else
{
if diff > hh Then
{
hh = diff;
clr = Red;
Text_SetString(Htx,NumToStr(HH,2));
}
else if diff < ll Then
{
ll = diff;
clr = Blue;
Text_SetString(Ltx,NumToStr(LL,2));
}
Else
{
if diff > diff[1] Then
clr = Magenta;
Else
clr = Cyan;
}
Text_SetLocation(Htx,sDate,sTime,HH);
Text_SetLocation(Ltx,sDate,sTime,LL);
}
Plot1(diff,"diff",clr);#막대
plot2(hh,"hh",Red);#선
plot3(ll,"ll",Blue);#선
tx = text_new_self(sDate,sTime,diff,NumToStr(diff,2));
Text_SetStyle(tx,2,0);
Text_SetColor(tx,Black);
2025-07-11
281
글번호 192385
시스템
답변완료
종목 검색 부탁드립니다.
1. 아래 수식을 참고하여 , 수식5 ) 가중이격도가 기준선 100 돌파시 ,
종목 검색식 부탁드려요
수식1) 기본
baseDis = (C / avg(C,Per))*100
수식2) RSI 계산
rsiUp = avg(max(C - C(1),0),rsiPer);
rsiDown = avg(max(C(1) - C ,0),rsiPer);
rsiVal = 100 - (100 / (1+rsiUp / rsiDown))
수식3) RSI 가중치
rsiWeight = if(rsiVal <= 50,
0.5 + (rsiVal * 0.01), // 50 이하일때
0.5 + ((rsiVal -50)* 0.03)) // 50 초과일때
수식4) 거래량가중치
volAvg = avg(V,volPer);
volWeight = if(volAvg! = 0,V / volAvg, 1.0
수식5) 가중이격도
rsiVolWeight = if(rsiVal < 30 and volWeight > 1.2, 0.8,
if(rsiVal > 70 and volWeight > 1.2, 1.3, 1.0));
weightedDis = baseDis * rsiWeight * volWeight * rsiVolWeight;
smoothedWeightedDis = avg(weightedDis, 3)
---------------
지표변수
Per 50
volPer 50
rsiPer 20
---------------
기준선 100
2025-07-09
204
글번호 192381
종목검색
답변완료
종목검색식으로 바꿔 주세요
건강하세요 30분봉에서 사용 할깨요
input : length_low(72);
input : length_high(36);
input : refit_interval(50);
input : vol_period(20);
input : vol_smooth_len(5);
input : bull_col(BluE);
input : bear_col(red);
// ───── CCI-based Oscillator with Clipping ─────
var : raw1(0),clipped1(0),osc_low(0);
var : raw2(0),clipped2(0),osc_high(0);
raw1 = cci(length_low);
clipped1 = max(min(raw1, 100), -100);
osc_low = clipped1 / 200 + 0.5;
raw2 = cci(length_high);
clipped2 = max(min(raw2, 100), -100);
osc_high = clipped2 / 200 + 0.5;
// ───── Volatility Calculations ─────
var : returns(0),vol_current_raw(0),vol_current_smoothed(0);
returns = close / close[1] - 1;
vol_current_raw = std(returns, vol_period);
vol_current_smoothed = ma(vol_current_raw, vol_smooth_len);
// ───── Volatility History Management ─────
var : i(0),ii(0);
Array : vola[150](Nan);
if IsNan(vol_current_raw) == False Then
{
ii = 0;
For i = 149 DownTo 1
{
vola[i] = vola[i-1];
if IsNan(vola[i]) == true Then
ii = i;
}
vola[0] = vol_current_raw;
}
var : c1(Nan),c2(Nan),val(0),temp(0);
var : median(0),sum_low(0),count_low(0),sum_high(0),count_high(0);
if ii < 10 Then
{
c1 = Nan;
c2 = Nan;
}
Else
{
median = MedianArray(vola,ii);
sum_low = 0.0;
count_low = 0;
sum_high = 0.0;
count_high = 0;
for i = 0 to ii - 1
{
val = vola[i];
if val < median Then
{
sum_low = sum_low + val;
count_low = count_low + 1;
}
else
{
sum_high = sum_high + val;
count_high = count_high + 1;
}
}
c1 = iff(count_low > 0 , sum_low / count_low , Nan);
c2 = iff(count_high > 0 , sum_high / count_high , Nan);
}
// ───── Volatility Regime Variables (with type) ─────
var : cluster_1(Nan),cluster_2(Nan),last_refit_bar(Nan),vol_regime(Nan);
if index - last_refit_bar >= refit_interval and ii >= 149 Then
{
if IsNan(c1) == False and IsNan(c2) == False Then
{
cluster_1 = iff(IsNan(cluster_1) == true , c1 , cluster_1 + 0.1 * (c1 - cluster_1));
cluster_2 = iff(IsNan(cluster_2) == true , c2 , cluster_2 + 0.1 * (c2 - cluster_2));
last_refit_bar = index;
}
if cluster_1 > cluster_2 Then
{
temp = cluster_1;
cluster_1 = cluster_2;
cluster_2 = temp;
}
}
var : mid(0),relevant_osc(0),trend_regime(Nan);
if IsNan(vol_current_smoothed) == False and IsNan(cluster_1) == False and IsNan(cluster_2) == False Then
{
mid = (cluster_1 + cluster_2) / 2;
vol_regime = iff(vol_current_smoothed < mid , 0 , 1);
}
// ───── Oscillator S e l e c t i o n ─────
relevant_osc = iff(vol_regime == 1 , osc_high , osc_low);
// ───── Trend Regime Detection ─────
trend_regime = iff(relevant_osc > 0.75 , 1 , iff(relevant_osc < 0.25 , -1 , 0));
// ───── Plots ─────
PlotBaseLine1(0.5, "Mid", gray);
PlotBaseLine2(-0.2,"-0.2", Gray);
PlotBaseLine3(1.2,"1.2",Gray);
plot1(osc_low, "Slow CCI", iff(osc_low >= 0.5 , bull_col , bear_col));
plot2(osc_high, "Fast CCI", iff(osc_high >= 0.5 , bull_col , bear_col));
var : tx(0),box(0);
if trend_regime == 1 Then
{
if trend_regime[1] != 1 Then
{
tx = Text_New_Self(sDate,sTime,1.2,"▲▲▲");
Text_SetStyle(tx,2,0);
Text_SetColor(tx,bull_col);
box = Box_New_Self(sDate,sTime,1.2,NextBarSdate,NextBarStime,-0.2);
Box_SetColor(box,bull_col);
Box_SetFill(box,true);
}
Else
Box_SetEnd(box,NextBarSdate,NextBarStime,-0.2);
}
if trend_regime == -1 Then
{
if trend_regime[1] != -1 Then
{
tx = Text_New_Self(sDate,sTime,-0.2,"▼▼▼");
Text_SetStyle(tx,2,1);
Text_SetColor(tx,bear_col);
box = Box_New_Self(sDate,sTime,1.2,NextBarSdate,NextBarStime,-0.2);
Box_SetColor(box,bear_col);
Box_SetFill(box,true);
}
Else
Box_SetEnd(box,NextBarSdate,NextBarStime,-0.2);
}
2025-07-09
241
글번호 192373
검색