Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (EternallyCurious, howardR), 646 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
QQE Indicator Conversion from MT4 #475788
01/08/19 02:29
01/08/19 02:29
Joined: Dec 2018
Posts: 5
P
PriceAlgoTrader Offline OP
Newbie
PriceAlgoTrader  Offline OP
Newbie
P

Joined: Dec 2018
Posts: 5
I'm not to familiar with MT4 code. I'm trying to convert this to Zorro Lite C - can anyone help??

:

#property indicator_separate_window

#property indicator_buffers 2

#property indicator_color1 Navy
#property indicator_style1 STYLE_SOLID
#property indicator_width1 2

#property indicator_color2 Red
#property indicator_style2 STYLE_DOT


extern int RSI_Period = 14;
extern int SF = 5;
extern double WF = 4.236;

int Wilders_Period;
int StartBar;

double TrLevelSlow[];
double AtrRsi[];
double MaAtrRsi[];
double Rsi[];
double RsiMa[];

int init()
{
Wilders_Period = RSI_Period * 2 - 1;
if (Wilders_Period < SF)
StartBar = SF;
else
StartBar = Wilders_Period;

IndicatorBuffers(6);
SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
SetIndexLabel(0, "Value 1");
SetIndexDrawBegin(0, StartBar);
SetIndexStyle(1, DRAW_LINE, STYLE_DOT);
SetIndexLabel(1, "Value 2");
SetIndexDrawBegin(1, StartBar);
IndicatorShortName(StringConcatenate("QQE(", SF, ")"));

SetIndexBuffer(0, RsiMa);
SetIndexBuffer(1, TrLevelSlow);
SetIndexBuffer(2, Rsi);
SetIndexBuffer(3, AtrRsi);
SetIndexBuffer(4, MaAtrRsi);

return(0);
}


int start()
{
int counted, i;
double rsi0, rsi1, dar, tr, dv;

if(Bars <= StartBar)
return (0);

counted = IndicatorCounted();
if(counted < 1)
for(i = Bars - StartBar; i < Bars; i++)
{
TrLevelSlow[i] = 0.0;
AtrRsi[i] = 0.0;
MaAtrRsi[i] = 0.0;
Rsi[i] = 0.0;
RsiMa[i] = 0.0;
}

counted = Bars - counted - 1;

for (i = counted; i >= 0; i--)
Rsi[i] = iRSI(NULL, 0, RSI_Period, PRICE_CLOSE, i);

for (i = counted; i >= 0; i--)
{
RsiMa[i] = iMAOnArray(Rsi, 0, SF, 0, MODE_EMA, i);
AtrRsi[i] = MathAbs(RsiMa[i + 1] - RsiMa[i]);
}

for (i = counted; i >= 0; i--)
MaAtrRsi[i] = iMAOnArray(AtrRsi, 0, Wilders_Period, 0, MODE_EMA, i);

i = counted + 1;
tr = TrLevelSlow[i];
rsi1 = iMAOnArray(Rsi, 0, SF, 0, MODE_EMA, i);
while (i > 0)
{
i--;
rsi0 = iMAOnArray(Rsi, 0, SF, 0, MODE_EMA, i);
dar = iMAOnArray(MaAtrRsi, 0, Wilders_Period, 0, MODE_EMA, i) * WF; //* 4.236;

dv = tr;
if (rsi0 < tr)
{
tr = rsi0 + dar;
if (rsi1 < dv)
if (tr > dv)
tr = dv;
}
else if (rsi0 > tr)
{
tr = rsi0 - dar;
if (rsi1 > dv)
if (tr < dv)
tr = dv;
}
TrLevelSlow[i] = tr;
rsi1 = rsi0;
}

return(0);
}

Re: QQE Indicator Conversion from MT4 [Re: PriceAlgoTrader] #475831
01/09/19 14:01
01/09/19 14:01
Joined: Oct 2017
Posts: 52
Brazil
J
jmlocatelli Offline
Junior Member
jmlocatelli  Offline
Junior Member
J

Joined: Oct 2017
Posts: 52
Brazil
Hi,
I'm also looking for a QQE indicator for Zorro.
MetaTrader coding is not a simple task.
Yesterday I found a QQE version for Amibroker.
I will try to convert it to Zorro.

QQE_Periods = 14;
QQE_SF = 5;

QQE_RSI_MA = EMA(RSI(QQE_Periods),QQE_SF);
QQE_ATR_RSI = abs(Ref(QQE_RSI_MA,-1)-QQE_RSI_MA);
QQE_MA_ATR_RSI = EMA(QQE_ATR_RSI, 2*QQE_Periods-1);
QQE_DAR = EMA(QQE_MA_ATR_RSI, 2*QQE_Periods-1)*4.236;
QQE_DAR_Fast = EMA(QQE_MA_ATR_RSI, 2*QQE_Periods-1)*2.618;

function QQE_TR(RSIMA, DARFACTOR)
{
result[0] = 0;
for(i=1; i<BarCount; i++)
{
if(RSIMA[i] < result[i-1])
{
result[i] = RSIMA[i]+DARFACTOR[i];
if((RSIMA[i-1] < result[i-1]) AND (result[i] > result[i-1]))
{
result[i] = result[i-1];
}
}
else
{
if(RSIMA[i] > result[i-1])
{
result[i] = RSIMA[i]-DARFACTOR[i];
if ((RSIMA[i-1] > result[i-1]) AND (result[i] < result[i-1]))
{
result[i] = result[i-1];
}
}
}
}
return result;
}

QQE_FastSignal = QQE_TR(QQE_RSI_MA,QQE_DAR_Fast);
QQE_SlowSignal = QQE_TR(QQE_RSI_MA,QQE_DAR);

Plot(QQE_RSI_MA,"QQE"+_PARAM_VALUES(),ParamColor("QQE color",colorRed),ParamStyle("QQE style",styleThick));
Plot(QQE_FastSignal,"FastSignal",ParamColor("FastSignal color",colorOrange),ParamStyle("FastSignal style",styleDashed));
Plot(QQE_SlowSignal,"SlowSignal",ParamColor("SlowSignal color",colorBlue),ParamStyle("SlowSignal style",styleDashed));

Last edited by jmlocatelli; 01/09/19 14:04.
Re: QQE Indicator Conversion from MT4 [Re: jmlocatelli] #475838
01/09/19 20:13
01/09/19 20:13
Joined: Oct 2017
Posts: 52
Brazil
J
jmlocatelli Offline
Junior Member
jmlocatelli  Offline
Junior Member
J

Joined: Oct 2017
Posts: 52
Brazil
Maybe better to work from the scratch based on QQE definition:
The QQE indicator consists of a smoothed Relative Strength Index (RSI) indicator and two volatility-based trailing levels (fast and slow). The Fast Trailing Level (TL) and Slow TL are constructed by calculating the ATR of the smoothed RSI over n-periods and then further smoothing the ATR using an additional n-periods Wilders smoothing function. This smoothed ATR of RSI is then multiplied by the Fast and Slow ATR Multipliers to calculate the final Fast and Slow Trailing Levels.

Re: QQE Indicator Conversion from MT4 [Re: jmlocatelli] #475843
01/10/19 01:21
01/10/19 01:21
Joined: Dec 2018
Posts: 5
P
PriceAlgoTrader Offline OP
Newbie
PriceAlgoTrader  Offline OP
Newbie
P

Joined: Dec 2018
Posts: 5
On tradingview they had this:

//By Glaz
study("QQE MT4")
RSI_Period = input(14,title='RSI')
SF = input(5,title='Slow Factor')
QQE=input(4.236)

Wilders_Period = RSI_Period * 2 - 1


Rsi = rsi(close,RSI_Period)
RsiMa = ema(Rsi, SF)
AtrRsi = abs(RsiMa[1] - RsiMa)
MaAtrRsi = ema(AtrRsi, Wilders_Period)
dar = ema(MaAtrRsi,Wilders_Period) * QQE


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
trend=cross(RSIndex, shortband[1])?1:cross(longband[1], RSIndex)?-1:nz(trend[1],1)
FastAtrRsiTL = trend==1? longband: shortband

plot(FastAtrRsiTL,color=red)
plot(RsiMa,color=yellow)

Re: QQE Indicator Conversion from MT4 [Re: PriceAlgoTrader] #475844
01/10/19 01:22
01/10/19 01:22
Joined: Dec 2018
Posts: 5
P
PriceAlgoTrader Offline OP
Newbie
PriceAlgoTrader  Offline OP
Newbie
P

Joined: Dec 2018
Posts: 5
Will be interesting to see what you come up with, I'm trying to give it a go myself

Re: QQE Indicator Conversion from MT4 [Re: PriceAlgoTrader] #475970
01/16/19 03:03
01/16/19 03:03
Joined: Dec 2018
Posts: 5
P
PriceAlgoTrader Offline OP
Newbie
PriceAlgoTrader  Offline OP
Newbie
P

Joined: Dec 2018
Posts: 5
This is what I have so far, isn't working properly yet... not sure why.




var QQE_TR(vars RSIMA, vars DARFACTOR) ;

function run(){

StartDate = 2018;
BarPeriod = 60;
LookBack = 1000;

set( PLOTNOW);



int QQE_Periods = 14;
int QQE_SF = 5;
int QQE_Wilders_Period = QQE_Periods * 2 - 1;


vars Price = series( price() );

vars QQE_RSI = series( RSI( Price, QQE_Periods));
vars QQE_RSI_MA = series( EMA(QQE_RSI,QQE_SF));
vars QQE_ATR_RSI = series( abs( QQE_RSI_MA[1]-QQE_RSI_MA[0] ));
vars QQE_MA_ATR_RSI = series( EMA(QQE_ATR_RSI, QQE_Wilders_Period));
vars QQE_DAR = series( EMA(QQE_MA_ATR_RSI, QQE_Wilders_Period)*4.236 );
vars QQE_DAR_Fast = series( EMA(QQE_MA_ATR_RSI, QQE_Wilders_Period)*2.618);


var QQE_FastSignal = QQE_TR(QQE_RSI_MA,QQE_DAR_Fast) ;
var QQE_SlowSignal = QQE_TR(QQE_RSI_MA,QQE_DAR) ;



plot("QQE Fast Signal", QQE_FastSignal, NEW, BLUE );
plot("QQE Slow Signal", QQE_SlowSignal, 0, RED);

plot("QQE_RSI", QQE_RSI, NEW, BLUE );
plot("QQE_RSI MA", QQE_RSI_MA, 0, RED );

plot("QQE_ATR_RSI", QQE_ATR_RSI, NEW, BLUE );
plot("QQE_MA_ATR_RSI MA", QQE_MA_ATR_RSI, 0, RED );

plot("QQE_DAR", QQE_DAR, NEW, BLUE );
plot("QQE_DAR_Fast MA", QQE_DAR_Fast, 0, RED );
}


var QQE_TR(vars RSIMA, vars DARFACTOR)
{


vars result = series();
result[0] = result[1] = 0;

int i;

for(i=1; i<3; i++)
{

if(RSIMA[i] < result[i-1])
{
result[i] = RSIMA[i]+DARFACTOR[i];
if((RSIMA[i-1] < result[i-1]) && (result[i] > result[i-1]))
{
result[i] = result[i-1];
}
}
else
{
if(RSIMA[i] > result[i-1])
{
result[i] = RSIMA[i]-DARFACTOR[i];
if ((RSIMA[i-1] > result[i-1]) && (result[i] < result[i-1]))
{
result[i] = result[i-1];
}
}
}

}

return result[1];


}

Last edited by PriceAlgoTrader; 01/16/19 03:06.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1