예스스탁
예스스탁 답변
2024-11-27 14:00:28
안녕하세요
예스스탁입니다.
request.security(syminfo.tickerid, tf, pred_ranges(length, mult))
해당식에 위와 같이 tf값을 변경하면 타주기를 계산하는 부분이 있는데
해당 내용까지는 작성해 드리기 여렵습니다.
적용하는 차트 주기로만 계산을 합니다.
input : length(200);
input : mult(6);
var : src(0),agv(0),hold_atr(0),a(0);
var : prR2(0),prR1(0),prS1(0),prS2(0);
src = c;
agv = src;
hold_atr = 0;
a = iff(isnan(atr(length)) ==true,0,ATR(Length)) * mult;
agv = iff(src - agv > a , agv + a , IFf( agv - src > a , agv - a ,agv));
hold_atr = iff(agv != agv[1] , a / 2 , hold_atr);
prR2 = agv + hold_atr * 2;
prR1 = agv + hold_atr;
prS1 = agv - hold_atr;
prS2 = agv - hold_atr * 2;
plot1(prR2, "PR Upper 2");
plot2(prR1, "PR Upper 1");
plot3(agv , "PR Average");
plot4(prS1, "PR Lower 1");
plot5(prS2, "PR Lower 2");
즐거운 하루되세요
> 비듬싸순 님이 쓴 글입니다.
> 제목 : 수고하십니다
>
항상노고에 감사드리며
변환부탁드립니다
indicator("Predictive Ranges [LuxAlgo]", "LuxAlgo - Predictive Ranges", overlay = true)
//------------------------------------------------------------------------------
//Settings
//-----------------------------------------------------------------------------{
length = input.int(200, 'Length', minval = 2)
mult = input.float(6., 'Factor', minval = 0, step = .5)
tf = input.timeframe('', 'Timeframe')
src = input(close, 'Source')
//-----------------------------------------------------------------------------}
//Function
//-----------------------------------------------------------------------------{
pred_ranges(length, mult)=>
var avg = src
var hold_atr = 0.
atr = nz(ta.atr(length)) * mult
avg := src - avg > atr ? avg + atr :
avg - src > atr ? avg - atr :
avg
hold_atr := avg != avg[1] ? atr / 2 : hold_atr
[avg + hold_atr * 2, avg + hold_atr, avg, avg - hold_atr, avg - hold_atr * 2]
//-----------------------------------------------------------------------------}
//Calculation
//-----------------------------------------------------------------------------{
[prR2
, prR1
, avg
, prS1
, prS2] = request.security(syminfo.tickerid, tf, pred_ranges(length, mult))
//-----------------------------------------------------------------------------}
//Plots
//-----------------------------------------------------------------------------{
plot_pru2 = plot(prR2, 'PR Upper 2', avg != avg[1] ? na : #f23645)
plot_pru1 = plot(prR1, 'PR Upper 1', avg != avg[1] ? na : #f23645)
plot_pravg = plot(avg , 'PR Average', avg != avg[1] ? na : #5b9cf6)
plot_prl1 = plot(prS1, 'PR Lower 1', avg != avg[1] ? na : #089981)
plot_prl2 = plot(prS2, 'PR Lower 2', avg != avg[1] ? na : #089981)
//Fills
fill(plot_pru2, plot_pru1, avg != avg[1] ? na : color.new(#f23645, 95))
fill(plot_prl1, plot_prl2, avg != avg[1] ? na : color.new(#089981, 95))