예스스탁
예스스탁 답변
2025-02-21 13:59:20
안녕하세요
예스스탁입니다.
input : 타주기분(5), myPeriod(14);
input : showCycler(true);
input : lvl(50);
var : src(0),myRSI(0),firstcolor(0),secondcolor(0),thirdcolor(0);
var : cycler(Nan),mycolor(Nan);
var : cnt(0),S1(0),D1(0),TM(0),TF(0);
var : SigSum(0),count2(0),RSIsig(0);
Var : Counter(0), DownAmt(0), UpAmt(0), UpSum(0), DownSum(0), UpAvg(0), DownAvg(0);
var : idx(0), PreUpAvg(0), preDownAvg(0),RSIV(0);
Array : C1[100](0);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 타주기분 > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and 타주기분 > 1 and TM >= TM[1]+타주기분) or
(Bdate == Bdate[1] and 타주기분 == 1 and TM > TM[1]) Then
{
for cnt = 1 to 99{
C1[cnt] = C1[cnt-1][1];
}
PreUpAvg = UpAvg[1];
preDownAvg = DownAvg[1];
idx = idx + 1;
}
C1[0] = C;
If idx == myPeriod+2 Then {
UpSum = 0;
DownSum = 0;
For Counter = 0 To myPeriod - 1 {
UpAmt = C1[Counter] - C1[Counter+1];
If UpAmt >= 0 Then
DownAmt = 0;
Else{
DownAmt = -UpAmt;
UpAmt = 0;
}
UpSum = UpSum + UpAmt;
DownSum = DownSum + DownAmt;
}
UpAvg = UpSum / myPeriod;
DownAvg = DownSum / myPeriod;
}
If idx > myPeriod+2 Then {
UpAmt = C1[0] - C1[1];
If UpAmt >= 0 Then
DownAmt = 0;
Else {
DownAmt = -UpAmt;
UpAmt = 0;
}
UpAvg = (PreUpAvg * (myPeriod - 1) + UpAmt) / myPeriod;
DownAvg = (preDownAvg * (myPeriod - 1) + DownAmt) / myPeriod;
}
If UpAvg + DownAvg <> 0 Then
RSIv = 100 * UpAvg / (UpAvg + DownAvg);
Else
RSIv = 0;
}
src = close;
myRSI = RSIv;
firstcolor = white;
secondcolor = orange;
thirdcolor = gray;
PlotBaseLine1(30,"Low",firstcolor);
PlotBaseLine2(70,"High",firstcolor);
PlotBaseLine3(20,"Second Low",secondcolor);
PlotBaseLine4(80,"Second High",secondcolor);
PlotBaseLine5(40,"40 Line",thirdcolor);
PlotBaseLine6(60,"60 Line",thirdcolor);
plot1(myRSI,"RSI",White);
if myRSI >= 70 or myRSI<= 30 Then
plot2(myRSI,"Oversold color");
Else
NoPlot(2);
//cycler
if myRSI > 69 or myRSI< 31 Then
{
if myRSI > 69 Then
cycler = 1; // bullish
else
cycler = 2; // bearish
}
else
{
if (cycler[1] == 1 and myRSI < 39) or (cycler[1] == 2 and myRSI > 61) Then
cycler = 0;
else
cycler = cycler[1];
}
if cycler == 0 Then
mycolor = white;
else
{
if cycler == 1 Then
mycolor = lime;
else
mycolor = red;
}
if showCycler == true Then
plot3(lvl,"Cycler colors",mycolor);
Else
NoPlot(3);
즐거운 하루되세요
> 레전드 님이 쓴 글입니다.
> 제목 : 문의
> input : myPeriod(14);
input : showCycler(true);
input : lvl(50);
var : src(0),myRSI(0),firstcolor(0),secondcolor(0),thirdcolor(0);
var : cycler(Nan),mycolor(Nan);
src = close;
myRSI = rsi(myPeriod);
firstcolor = white;
secondcolor = orange;
thirdcolor = gray;
PlotBaseLine1(30,"Low",firstcolor);
PlotBaseLine2(70,"High",firstcolor);
PlotBaseLine3(20,"Second Low",secondcolor);
PlotBaseLine4(80,"Second High",secondcolor);
PlotBaseLine5(40,"40 Line",thirdcolor);
PlotBaseLine6(60,"60 Line",thirdcolor);
plot1(myRSI,"RSI",White);
if myRSI >= 70 or myRSI<= 30 Then
plot2(myRSI,"Oversold color");
Else
NoPlot(2);
//cycler
if myRSI > 69 or myRSI< 31 Then
{
if myRSI > 69 Then
cycler = 1; // bullish
else
cycler = 2; // bearish
}
else
{
if (cycler[1] == 1 and myRSI < 39) or (cycler[1] == 2 and myRSI > 61) Then
cycler = 0;
else
cycler = cycler[1];
}
if cycler == 0 Then
mycolor = white;
else
{
if cycler == 1 Then
mycolor = lime;
else
mycolor = red;
}
if showCycler == true Then
plot3(lvl,"Cycler colors",mycolor);
Else
NoPlot(3);
외부변수로 타주기로 나타나도록 부탁드립니다