예스스탁
예스스탁 답변
2021-04-27 15:44:16
안녕하세요
예스스탁입니다.
수식내용이 지표만 있습니다.
어떤 내용으로 진입/청산을 하는지 알수 없습니다. 지표식만 올려드립니다.
예스랭귀지에서는 색상예약어나 RGB함수로 색상을 지정합니다.색상을 조절하시기 바랍니다.
그래프의 모양은 수식에서 설정이 되지 않습니다. 지표속성에서 설정하셔야 합니다.
input : dlen(20);
var : h1(0),l1(0),maintrend(0),cnt(0),ii(0);
input : n(0);
var : h2(0),l2(0);
Array : Trend[10](0),trendcolor[10](0);
h1 = highest(h,dlen);
l1 = lowest(L,dlen);
if C > h1[1] Then
maintrend = 1;
if C < l1[1] then
maintrend = -1;
For cnt = 0 to 9
{
h2 = 0;
L2 = 0;
For ii = 1 to dlen-cnt
{
if h2 == 0 or (h2 > 0 and h[ii] > h2) Then
h2 = h[ii];
if l2 == 0 or (l2 > 0 and l[ii] < l2) Then
l2 = l[ii];
}
if C > h2 Then
trend[cnt] = 1;
if C < l2 then
trend[cnt] = -1;
trendcolor[cnt] = iff(maintrend == 1 ,IFf(trend[cnt] == 1 , RGB(0,255,0) , CYAN),
IFf(maintrend == -1,IFf(trend[cnt] == -1 ,RGB(255,0,0) , MAGENTA),Nan));
}
plot1(05,"1",trendcolor[n]);
plot2(10,"2",trendcolor[1]);
plot3(15,"3",trendcolor[2]);
plot4(20,"4",trendcolor[3]);
plot5(25,"5",trendcolor[4]);
plot6(30,"6",trendcolor[5]);
plot7(35,"7",trendcolor[6]);
plot8(40,"8",trendcolor[7]);
plot9(45,"9",trendcolor[8]);
plot10(50,"10",trendcolor[9]);
즐거운 하루되세요
> dandan 님이 쓴 글입니다.
> 제목 : 수식변경 부탁드립니다.
> 아래 TradingView 수식(Donchian Trend Ribbon) 변경부탁드립니다.
1. 지표와 전략 두개로 작성 부탁드립니다. 함수로 작성하여 분리해주셔도 감사하겠습니다.
매매기준은 색상변환시 입니다.
2. 추세색상(형광, 빨강) 이외에 추세전환전 옅게 색칠되는 부분이 잘 보였으면 좋겠습니다.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © LonesomeTheBlue
//@version=4
study("Donchian Trend Ribbon")
dlen = input(defval = 20, title = "Donchian Channel Period", minval = 10)
dchannel(len)=>
float hh = highest(len)
float ll = lowest(len)
int trend = 0
trend := close > hh[1] ? 1 : close < ll[1] ? -1 : nz(trend[1])
trend
dchannelalt(len, maintrend)=>
float hh = highest(len)
float ll = lowest(len)
int trend = 0
trend := close > hh[1] ? 1 : close < ll[1] ? -1 : nz(trend[1])
trendcolor = maintrend == 1 ? trend == 1 ? #00FF00ff : #00FF009f :
maintrend == -1 ? trend == -1 ? #FF0000ff : #FF00009f :
na
trendcolor
maintrend = dchannel(dlen)
plot(05, color = dchannelalt(dlen - 0, maintrend), style = plot.style_columns, histbase=00)
plot(10, color = dchannelalt(dlen - 1, maintrend), style = plot.style_columns, histbase=05)
plot(15, color = dchannelalt(dlen - 2, maintrend), style = plot.style_columns, histbase=10)
plot(20, color = dchannelalt(dlen - 3, maintrend), style = plot.style_columns, histbase=15)
plot(25, color = dchannelalt(dlen - 4, maintrend), style = plot.style_columns, histbase=20)
plot(30, color = dchannelalt(dlen - 5, maintrend), style = plot.style_columns, histbase=25)
plot(35, color = dchannelalt(dlen - 6, maintrend), style = plot.style_columns, histbase=30)
plot(40, color = dchannelalt(dlen - 7, maintrend), style = plot.style_columns, histbase=35)
plot(45, color = dchannelalt(dlen - 8, maintrend), style = plot.style_columns, histbase=40)
plot(50, color = dchannelalt(dlen - 9, maintrend), style = plot.style_columns, histbase=45)