예스스탁
예스스탁 답변
2022-09-05 11:09:34
안녕하세요
예스스탁입니다.
1
input : length(100);
var : src(0),a(0),b(0),avgv(0),idx1(0),idx2(0);
var : bullish(False),clr(0);
src = close;
a = 0;
b = 0;
if CurrentBar >= 1 Then
{
a = max(src,a[1]) - (a[1] - b[1])/length;
b = min(src,b[1]) + (a[1] - b[1])/length;
avgv = avg(a,b);
if b[1] < close[1] and b > close Then
idx1 = 0;
Else
{
if idx1 >= 0 Then
idx1 = idx1+1;
}
if a[1] < close[1] and a > close Then
idx2 = 0;
Else
{
if idx2 >= 0 Then
idx2 = idx2+1;
}
bullish = idx2 <= idx1;
clr = IFf(bullish , lime , red);
plot1(avgv,"Average",clr);
plot2(close,"Close price",clr);
}
2
input : length(100);
var : src(0),a(0),b(0),avgv(0),idx1(0),idx2(0);
var : bullish(False),clr(0);
src = close;
a = 0;
b = 0;
if CurrentBar >= 1 Then
{
a = max(src,a[1]) - (a[1] - b[1])/length;
b = min(src,b[1]) + (a[1] - b[1])/length;
avgv = avg(a,b);
if b[1] < close[1] and b > close Then
idx1 = 0;
Else
{
if idx1 >= 0 Then
idx1 = idx1+1;
}
if a[1] < close[1] and a > close Then
idx2 = 0;
Else
{
if idx2 >= 0 Then
idx2 = idx2+1;
}
bullish = idx2 <= idx1;
clr = IFf(bullish , lime , red);
if bullish == False and bullish[1] == true Then
Sell();
if bullish == true and bullish[1] == False Then
Buy();
}
즐거운 하루되세요
> alltoone 님이 쓴 글입니다.
> 제목 : 문의 드립니다.
> 아래 지표는 트레이딩 뷰에 있는 것인데요,
예스트레이더에 사용할 수 있도록 전환이 가능한가요?
지표와 시스템 가능하시면, 각각 부탁드립니다.
감사합니다.
study("G-Channel Trend Detection",shorttitle="G-Trend",overlay=true)
length = input(100),src = input(close)
//----
a = 0.,b = 0.
a := max(src,nz(a[1])) - nz(a[1] - b[1])/length
b := min(src,nz(b[1])) + nz(a[1] - b[1])/length
avg = avg(a,b)
//----
crossup = b[1] < close[1] and b > close
crossdn = a[1] < close[1] and a > close
bullish = barssince(crossdn) <= barssince(crossup)
c = bullish ? color.lime : color.red
//plot(a,"Upper",color=color.blue,linewidth=2,transp=100)
//plot(b,"Lower",color=color.blue,linewidth=2,transp=100)
p1=plot(avg,"Average",color=c,linewidth=1,transp=90)
p2=plot(close,"Close price",color=c,linewidth=1,transp=100)
fill(p1,p2,color=c,transp=90)
showcross = input(true)
plotshape(showcross and not bullish and bullish[1] ? avg : na, location=location.absolute, style=shape.labeldown, color=color.red, size=size.tiny, text="Sell", textcolor=#ffffff, transp=0, offset=-1)
plotshape(showcross and bullish and not bullish[1] ? avg : na, location=location.absolute, style=shape.labelup, color=color.lime, size=size.tiny, text="Buy", textcolor=#ffffff, transp=0, offset=-1)