예스스탁
예스스탁 답변
2024-08-08 16:31:34
안녕하세요
예스스탁입니다.
input : RSI_Period(14);
input : SF(5);
input : QQE(4.238);
input : ThreshHold(10);
var : src(0),Wilders_Period(0),R(0);
var : RsiMa(0),AtrRsi(0),MaAtrRsi(0),dar(0);
var : longband(0),shortband(0),trend(0);
var : DeltaFastAtrRsi(0),RSIndex(0),newshortband(0),newlongband(0);
var : cross_1(False),FastAtrRsiTL(0);
var : QQExlong(0),QQExshort(0),tx(0)
;
src = close;
Wilders_Period = RSI_Period * 2 - 1;
R = rsi(RSI_Period);
RsiMa = ema(R, SF);
AtrRsi = abs(RsiMa[1] - RsiMa);
MaAtrRsi = ema(AtrRsi, Wilders_Period);
dar = ema(MaAtrRsi, Wilders_Period) * QQE;
longband = 0.0;
shortband = 0.0;
trend = 0;
DeltaFastAtrRsi = dar;
RSIndex = RsiMa;
newshortband = RSIndex + DeltaFastAtrRsi;
newlongband = RSIndex - DeltaFastAtrRsi;
longband = iff(RSIndex[1] > longband[1] and RSIndex > longband[1] , max(longband[1], newlongband) , newlongband);
shortband = iff(RSIndex[1] < shortband[1] and RSIndex < shortband[1] , min(shortband[1], newshortband) , newshortband);
cross_1 = CrossUp(longband[1], RSIndex) or CrossDown(longband[1], RSIndex);
trend = IFf(CrossUp(RSIndex, shortband[1]) or CrossDown(RSIndex, shortband[1]) , 1 , IFf(cross_1 , -1 , iff(IsNaN(trend[1]) ==true, 1,trend[1])));
FastAtrRsiTL = iff(trend == 1 , longband , shortband);
// Find all the QQE Crosses
QQExlong = 0;
QQExlong = IFF(IsNan(QQExlong[1])==true,0,QQExlong[1]);
QQExshort = 0;
QQExshort = IFF(IsNan(QQExshort[1])==true,0,QQExshort[1]);
QQExlong = iff(FastAtrRsiTL < RSIndex , QQExlong + 1 , 0);
QQExshort = iff(FastAtrRsiTL > RSIndex , QQExshort + 1 , 0);
// Plotting
if QQExlong == 1 Then
{
tx = text_new(sDate,sTime,L-PriceScale*1,"Long");
Text_SetStyle(tx,2,0);
Text_SetColor(tx,Green);
}
if QQExshort == 1 Then
{
tx = text_new(sDate,sTime,H+PriceScale*1,"Short");
Text_SetStyle(tx,2,1);
Text_SetColor(tx,Red);
}
즐거운 하루되세요
> 삼손감자 님이 쓴 글입니다.
> 제목 : 변환 부탁드립니다.
> //@version=4
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © colinmck
study("QQE signals", overlay=true)
RSI_Period = input(14, title='RSI Length')
SF = input(5, title='RSI Smoothing')
QQE = input(4.238, title='Fast QQE Factor')
ThreshHold = input(10, title="Thresh-hold")
src = close
Wilders_Period = RSI_Period * 2 - 1
Rsi = rsi(src, RSI_Period)
RsiMa = ema(Rsi, SF)
AtrRsi = abs(RsiMa[1] - RsiMa)
MaAtrRsi = ema(AtrRsi, Wilders_Period)
dar = ema(MaAtrRsi, Wilders_Period) * QQE
longband = 0.0
shortband = 0.0
trend = 0
DeltaFastAtrRsi = dar
RSIndex = RsiMa
newshortband = RSIndex + DeltaFastAtrRsi
newlongband = RSIndex - DeltaFastAtrRsi
longband := RSIndex[1] > longband[1] and RSIndex > longband[1] ? max(longband[1], newlongband) : newlongband
shortband := RSIndex[1] < shortband[1] and RSIndex < shortband[1] ? min(shortband[1], newshortband) : newshortband
cross_1 = cross(longband[1], RSIndex)
trend := cross(RSIndex, shortband[1]) ? 1 : cross_1 ? -1 : nz(trend[1], 1)
FastAtrRsiTL = trend == 1 ? longband : shortband
// Find all the QQE Crosses
QQExlong = 0
QQExlong := nz(QQExlong[1])
QQExshort = 0
QQExshort := nz(QQExshort[1])
QQExlong := FastAtrRsiTL < RSIndex ? QQExlong + 1 : 0
QQExshort := FastAtrRsiTL > RSIndex ? QQExshort + 1 : 0
//Conditions
qqeLong = QQExlong == 1 ? FastAtrRsiTL[1] - 50 : na
qqeShort = QQExshort == 1 ? FastAtrRsiTL[1] - 50 : na
// Plotting
plotshape(qqeLong, title="QQE long", text="Long", textcolor=color.white, style=shape.labelup, location=location.belowbar, color=color.green, transp=0, size=size.tiny)
plotshape(qqeShort, title="QQE short", text="Short", textcolor=color.white, style=shape.labeldown, location=location.abovebar, color=color.red, transp=0, size=size.tiny)
// Alerts
alertcondition(qqeLong, title="Long", message="Long")
alertcondition(qqeShort, title="Short", message="Short")