|
|
QQE script
#413870
12/19/12 09:46
12/19/12 09:46
|
Joined: Nov 2012
Posts: 209
SFF
OP
Member
|
OP
Member
Joined: Nov 2012
Posts: 209
|
I have been trying to convert QQE from MT4 to Zorro's code. The new script doesn't work and I am confused as C beginner. My rule is very simple. When QQE line crosses over the other line, I will buy. When QQE line crosses under I will sell. I appreciate your help. The original MT4 QQE code: http://codebase.mql4.com/ru/source/6327My conversion which has many errors.
function run()
{
int SF = 5;
int RSI_Period = 14;
int Wilders_Period = RSI_Period * 2 - 1;
vars Rsi = series(RSI(series(priceClose()),RSI_Period));
vars Qqe = series(EMA(Rsi,SF));
vars AtrRsi = series(abs(Qqe[1] - Qqe[0]));
var Dar = EMA(AtrRsi,Wilders_Period);
Dar *= 4.236;
vars signal = series(0);
if(Qqe[0] < signal[1]){
if (Qqe[1] < signal[1] && signal[1] < Qqe[0] + Dar )
*signal = signal[1];
else
*signal = Qqe[0] + Dar;
}
else if ( Qqe[0] > signal[1] ){
if (Qqe[1] > signal[1] && signal[1] > Qqe[0] - Dar )
*signal = signal[1];
else
*signal = Qqe[0] - Dar;
}
if( Qqe[1] <= signal[1] && Qqe[0] > signal[0] ){
exitShort();
if(!NumOpenLong) enterLong();
}
if( Qqe[1] >= signal[1] && Qqe[0] < signal[0] ){
exitLong();
if(!NumOpenShort) enterShort();
}
}
Thanks in advance.
Last edited by SFF; 12/19/12 14:34.
|
|
|
Re: QQE script
[Re: jcl]
#413874
12/19/12 10:17
12/19/12 10:17
|
Joined: Nov 2012
Posts: 209
SFF
OP
Member
|
OP
Member
Joined: Nov 2012
Posts: 209
|
It seems ok when I added * before Rsi. var *Rsi = series(RSI(series(priceClose()),RSI_Period)); And I added it for the others var. It seems fine. Anyway, You have said I don't need to add * in this post. http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=412512#Post412512I understand that vars and var are not same. I removed the error of typo for Wilder_Periods. The next error is here. Error in 'line 20: syntax error < if ( Qqe < signal[1] ) Is it possible to compare an array element in if statement?
Last edited by SFF; 12/19/12 11:25.
|
|
|
Re: QQE script
[Re: jcl]
#413889
12/19/12 11:47
12/19/12 11:47
|
Joined: Nov 2012
Posts: 209
SFF
OP
Member
|
OP
Member
Joined: Nov 2012
Posts: 209
|
- When do you need a series, and when do you need a variable? I need them to calc values on every bars.
- How do you define a series? I assign series() to var pointer.
I just changed code but still an error.
if(*Qqe < *(signal+1))
When do you add * and when not?
When I want to use a value of series, I add it.
Last edited by SFF; 12/19/12 12:07.
|
|
|
Re: QQE script
[Re: SFF]
#413891
12/19/12 12:06
12/19/12 12:06
|
Joined: Jul 2000
Posts: 28,075 Frankfurt
jcl

Chief Engineer
|

Chief Engineer
Joined: Jul 2000
Posts: 28,075
Frankfurt
|
- When do you need a series, and when do you need a variable? I need them to calc values on every bars. No. You need a series when you use values from previous bars for your current calculation. So, for which of your variables do you need a series, and for which not? - How do you define a series? I assign series() to var pointer. Yes. Now look at your code. Have you always assigned series() to var pointers? - When do you add * and when not? When I want to use a value of series, I add it. No. You add it only in the definition of a series, and only when you're following the old version of the tutorial. In the current version, there is no '*' anymore as series are defined with 'vars' instead. But you can still use the old method of course.
|
|
|
|