답변완료
부탁드립니다.
변형 부탁 드립니다.
indicator("RSI Multi Length [LuxAlgo]")
max = input(20,'Maximum Length')
min = input(10,'Minimum Length')
overbought = input.float(70,step=10)
oversold = input.float(30,step=10)
src = input(close)
//----
rsi_avg_dn_css = input(#ff5d00,'Average RSI Gradient',group='Style',inline='inline1')
rsi_avg_up_css = input(#2157f3,'',group='Style',inline='inline1')
upper_css = input(#0cb51a,'Upper Level',group='Style')
lower_css = input(#ff1100,'Lower Level',group='Style')
ob_area = input(color.new(#0cb51a,70),'Overbought Area',group='Style')
os_area = input(color.new(#ff1100,70),'Oversold Area',group='Style')
//----
N = max-min+1
diff = nz(src - src[1])
var num = array.new_float(N,0)
var den = array.new_float(N,0)
//----
k = 0
overbuy = 0
oversell = 0
avg = 0.
for i = min to max
alpha = 1/i
num_rma = alpha*diff + (1-alpha)*array.get(num,k)
den_rma = alpha*math.abs(diff) + (1-alpha)*array.get(den,k)
rsi = 50*num_rma/den_rma + 50
avg += rsi
overbuy := rsi > overbought ? overbuy + 1 : overbuy
oversell := rsi < oversold ? oversell + 1 : oversell
array.set(num,k,num_rma)
array.set(den,k,den_rma)
k += 1
//----
avg_rsi = avg/N
buy_rsi_ma = 0.
sell_rsi_ma = 0.
buy_rsi_ma := nz(buy_rsi_ma[1] + overbuy/N*(avg_rsi - buy_rsi_ma[1]),avg_rsi)
sell_rsi_ma := nz(sell_rsi_ma[1] + oversell/N*(avg_rsi - sell_rsi_ma[1]),avg_rsi)
//----
var tb = table.new(position.top_right,2,2)
if barstate.islast
table.cell(tb,0,0,'Overbought',text_color=color.gray,bgcolor=na)
table.cell(tb,1,0,'Oversold',text_color=color.gray,bgcolor=na)
table.cell(tb,0,1,str.tostring(overbuy/N*100,'#.##')+' %',text_color=#26a69a,bgcolor=color.new(#26a69a,80))
table.cell(tb,1,1,str.tostring(oversell/N*100,'#.##')+' %',text_color=#ef5350,bgcolor=color.new(#ef5350,80))
//----
css = color.from_gradient(avg_rsi,sell_rsi_ma,buy_rsi_ma,rsi_avg_dn_css,rsi_avg_up_css)
plot(avg_rsi,'Average Multi Length RSI',color=css)
up = plot(buy_rsi_ma,'Upper Channel',color=upper_css)
dn = plot(sell_rsi_ma,'Lower Channel',color=lower_css)
per_over = plot(overbuy/N*100,'Overbought Area',color=color.new(ob_area,100),editable=false)
per_under = plot(100 - oversell/N*100,'Oversold Area',color=color.new(os_area,100),editable=false)
upper = plot(100,color=na,editable=false,display=display.none)
lower = plot(0,color=na,editable=false,display=display.none)
fill(per_over,lower,ob_area)
fill(upper,per_under,os_area)
fill(up,dn,color.new(css,90))
hline(50,color=color.new(color.gray,50))
2023-08-13
919
글번호 171470
지표
답변완료
부탁드립니다
var : sd(0),st(0),ed(0),et(0),hh(0),ll(0),mm(0);
var : tt1(0),tt2(0),tt3(0),tt4(0),tt5(0),tt6(0),tt7(0),tt8(0),tt9(0),tt10(0);
var : xx1(0),xx2(0),xx3(0),xx4(0),xx5(0),xx6(0),xx7(0),xx8(0),xx9(0),xx10(0);
if T != T[1] then
{
if 고점[1,2] < 저점[1,2] then
{
sd = sdate[index-고점[1,2]];
st = stime[index-고점[1,2]];
ed = sdate[index-저점[1,2]];
et = stime[index-저점[1,2]];
hh = 고점[1,1];
ll = 저점[1,1];
mm = hh-ll;
}
if 고점[1,2] > 저점[1,2] then
{
sd = sdate[index-저점[1,2]];
st = stime[index-저점[1,2]];
ed = sdate[index-고점[1,2]];
et = stime[index-고점[1,2]];
hh = 고점[1,1];
ll = 저점[1,1];
mm = hh-ll;
}
}
항상 패턴이 완성된 봉을 기준으로 잡습니다.(1번//시가 2번//최고가 3번//최고가)
1= 1번 자리에서 패턴 완성후 횡보 또는 조정후 1번봉의 시가(기준봉)를 3% 이상 돌파하는
양봉이 나오거나 or
2= 앞전 패턴이 완성된 2번 자리의 고점을 0봉이 돌파 하거나 (양봉조건) or
3= 2번 자리의 고점을 3%이내로 근접하는 양봉이 나올때
1 or 2 or 3
주말 마무리 잘하시고 항상 감사 드립니다.
2023-08-13
1097
글번호 171465
종목검색
답변완료
수식 부탁드립니다.
파라볼릭지표와 엘더박사의 safe zone을 이용한 수식을 부탁드립니다.
#.진입 기준 ; 파라볼릭 종가 지표의 추세 반전.
#.청산 기준 ; 엘더박사의 safe zone
1.매수진입01; 종가기준의 파라볼릭지표가 하락하다가 상승 추세로 전환하면 그때 종가로 매수진입.
1)매수분 청산01; safe zone의 plot1을 상회한 후,하락반전하여 종가가 plot1선을 뚫고 내려오면 그때 종가에 청산.
2)매수분 청산02; plot1선을 넘지 못한 상태에서 plot2선을 뚫고 내려가면 그때 종가에 청산.
3)매수 재진입02 ; 청산01을 한 후, 청산2조건(plot2선 뚫고 하락)이 오지 않은 상태에서 청산01조건에 해당되는 봉의 고가를 넘으면 long 재진입.
2.매도진입01 ; 종가기준인 파라볼릭지표가 상승하다가 하락 추세로 전환하면 그때 종가로 매도진입.
1)매도분 청산01; safe zone의 plot2을 하회한 후,상승반전하여 종가가 plot2선을 뚫고 올라오면 그때 종가에 청산.
2)매도분 청산02; plot2선을 넘지 못한 상태에서 plot1선을 뚫고 올라가면 그때 종가에 청산.
3)매도 재진입02 ; 청산01을 한 후, 청산2조건(plot선 뚫고 상승)이 오지 않은 상태에서 청산01조건에 해당되는 봉의 저가를 하회하여 하락하면 short 재진입.
*혹시라도 매수재진입이나 매도재진입 수식이 불가하면 재진입부분의 수식은 제외해도 되고요.
- 아래 -
#. 지표 내역
1)파라볼릭 (종가기준)
Input : af(0.02), maxAF(0.2);
var1 = CSar(af,maxAF);
if var1 > C Then
Plot1(var1, "CSAR",BLACK);
Else
Plot1(var1, "CSAR",rgb(205, 92 ,92));
---------------------------------------------
2)엘더박사의 safe zone 내역 (gambler님 것)
input : lookbackLength(10), coeff(4);
var : count1(0), diff1(0), totalCount1(0), totalSum1(0), penAvg1(0), Safety1(0), finalSafety1(0);
var : count2(0), diff2(0), totalCount2(0), totalSum2(0), penAvg2(0), Safety2(0), finalSafety2(0);
//DownTrend Stop
if high > high[1] then
count1 = 1;
else
count1 = 0;
if high > high[1] then
diff1 = high - high[1];
else
diff1 = 0;
totalCount1 = accumN(count1, lookbackLength);
totalSum1 = accumN(diff1, lookbackLength);
penAvg1 = (totalSum1 / totalCount1);
safety1 = high[1] + (penAvg1[1] * coeff);
finalSafety1 = Min(safety1, safety1[1], safety1[2], safety1[3], safety1[4], safety1[5]);
//UpTrend Stop
if low < low[1] then
count2 = 1;
else
count2 = 0;
if low < low[1] then
diff2 = low[1] - low;
else
diff2 = 0;
totalCount2 = accumN(count2, lookbackLength);
totalSum2 = accumN(diff2, lookbackLength);
penAvg2 = (totalSum2 / totalCount2);
safety2 = low[1] - (penAvg2[1] * coeff);
finalSafety2 = Max(safety2, safety2[1], safety2[2], safety2[3], safety2[4], safety2[5]);
plot1(finalsafety1);
plot2(finalsafety2);
감사합니다.
2023-08-13
943
글번호 171463
시스템