예스스탁
예스스탁 답변
2024-11-14 14:39:51
안녕하세요
예스스탁입니다.
1. 시스템
input : length(20);
input : mult(2.0);
input : lengthKC(20);
input : multKC(1.5);
input : useTrueRange(true);#1:TrueRange 0:고저폭
var : source(0),basis(0),dev(0),upperbb(0),lowerbb(0);
var : mav(0),r(0),rangema(0),upperKC(0),lowerKC(0);
var : sqzOn(False),sqzOff(False),noSqz(False),val(0),bcolor(0),scolor(0);
// Calculate BB
source = close;
basis = ma(source, length);
dev = multKC * std(source, length);
upperBB = basis + dev;
lowerBB = basis - dev;
// Calculate KC
mav = ma(source, lengthKC);
r = iff(useTrueRange == 1 , TrueRange , (high - low));
rangema = ma(r, lengthKC);
upperKC = mav + rangema * multKC;
lowerKC = mav - rangema * multKC;
sqzOn = (lowerBB > lowerKC) and (upperBB < upperKC);
sqzOff = (lowerBB < lowerKC) and (upperBB > upperKC);
noSqz = (sqzOn == false) and (sqzOff == false);
val = LRL(source - avg(avg(highest(high, lengthKC), lowest(low, lengthKC)),ma(close,lengthKC)), lengthKC);
bcolor = iff( val > 0,
iff( val > iff(IsNan(val[1]),0,val[1]), lime, green),
iff( val < iff(IsNan(val[1]),0,val[1]), red, maroon));
scolor = iff(noSqz ,blue ,IFf( sqzOn , black , gray ));
if bcolor == lime and scolor == Gray Then
Buy("b");
if bcolor == green and scolor == black Then
ExitLong("bx");
2 지표
input : length(20);
input : mult(2.0);
input : lengthKC(20);
input : multKC(1.5);
input : useTrueRange(true);#1:TrueRange 0:고저폭
var : source(0),basis(0),dev(0),upperbb(0),lowerbb(0);
var : mav(0),r(0),rangema(0),upperKC(0),lowerKC(0);
var : sqzOn(False),sqzOff(False),noSqz(False),val(0),bcolor(0),scolor(0);
// Calculate BB
source = close;
basis = ma(source, length);
dev = multKC * std(source, length);
upperBB = basis + dev;
lowerBB = basis - dev;
// Calculate KC
mav = ma(source, lengthKC);
r = iff(useTrueRange == 1 , TrueRange , (high - low));
rangema = ma(r, lengthKC);
upperKC = mav + rangema * multKC;
lowerKC = mav - rangema * multKC;
sqzOn = (lowerBB > lowerKC) and (upperBB < upperKC);
sqzOff = (lowerBB < lowerKC) and (upperBB > upperKC);
noSqz = (sqzOn == false) and (sqzOff == false);
val = LRL(source - avg(avg(highest(high, lengthKC), lowest(low, lengthKC)),ma(close,lengthKC)), lengthKC);
bcolor = iff( val > 0,
iff( val > iff(IsNan(val[1]),0,val[1]), lime, green),
iff( val < iff(IsNan(val[1]),0,val[1]), red, maroon));
scolor = iff(noSqz ,blue ,IFf( sqzOn , black , gray ));
plot1(val,"막대",bcolor);
plot2(0,"선",scolor);
즐거운 하루되세요
> 안산개미 님이 쓴 글입니다.
> 제목 : 시스템 수식변환 요청드립니다.
> 안녕하세요. 트레이딩뷰에서 'Squeeze Momentum Indicator' (https://kr.tradingview.com/v/nqQ1DT5a/)를 예스랭귀지 시스템 수식으로 변환부탁드립니다.
비트코인 거래위한 매수시점은 위 사진의 회색선이 연두색 막대그래프와 만나는 지점으로 하고, 청산시점(매도)은 연두색 막대그래프가 검은색 선과 만나는 지점으로 하는 수식으로 해주세요.
아래는 수식입니다.
//
// @author LazyBear
// List of all my indicators: https://www.tradingview.com/v/4IneGo8h/
//
study(shorttitle = "SQZMOM_LB", title="Squeeze Momentum Indicator [LazyBear]", overlay=false)
length = input(20, title="BB Length")
mult = input(2.0,title="BB MultFactor")
lengthKC=input(20, title="KC Length")
multKC = input(1.5, title="KC MultFactor")
useTrueRange = input(true, title="Use TrueRange (KC)", type=bool)
// Calculate BB
source = close
basis = sma(source, length)
dev = multKC * stdev(source, length)
upperBB = basis + dev
lowerBB = basis - dev
// Calculate KC
ma = sma(source, lengthKC)
range = useTrueRange ? tr : (high - low)
rangema = sma(range, lengthKC)
upperKC = ma + rangema * multKC
lowerKC = ma - rangema * multKC
sqzOn = (lowerBB > lowerKC) and (upperBB < upperKC)
sqzOff = (lowerBB < lowerKC) and (upperBB > upperKC)
noSqz = (sqzOn == false) and (sqzOff == false)
val = linreg(source - avg(avg(highest(high, lengthKC), lowest(low, lengthKC)),sma(close,lengthKC)),
lengthKC,0)
bcolor = iff( val > 0,
iff( val > nz(val[1]), lime, green),
iff( val < nz(val[1]), red, maroon))
scolor = noSqz ? blue : sqzOn ? black : gray
plot(val, color=bcolor, style=histogram, linewidth=4)
plot(0, color=scolor, style=cross, linewidth=2)