Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
4 registered members (fogman, Grant, AndrewAMD, juanex), 989 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
QQE script #413870
12/19/12 09:46
12/19/12 09:46
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

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/6327

My conversion which has many errors.

Code:
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: SFF] #413873
12/19/12 10:11
12/19/12 10:11
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
Ok, that script has more errors than lines. So, some more reading of the tutorial might be required. Let's start with the first error that you get when running that script:

Error in 'line 13:
EMA(): Pointer expected
< var Qqe = series(EMA(Rsi,SF)); >

There is apparently something wrong with the parameters to that EMA call. I can tell you that it's the "Rsi" series. Look how you have defined it:

var Rsi = series(RSI(series(priceClose()),RSI_Period));

What is wrong here? How do you define a series?

Re: QQE script [Re: jcl] #413874
12/19/12 10:17
12/19/12 10:17
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

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#Post412512

I 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: SFF] #413877
12/19/12 10:57
12/19/12 10:57
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
Ok, let's go on.

if ( Qqe < signal[1]) ...

Qge is a series. signal[1] is a variable. You can certainly not compare a series with a variable. Therefore, your line makes no sense. You want to compare a variable of the series, not the series itself. How to you get a variable out of a series?

Re: QQE script [Re: jcl] #413881
12/19/12 11:09
12/19/12 11:09
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
I just wanted to compare the latest value of Qqe so I added [0].
if ( Qqe[0] < signal[1])

But there is still an error.

Re: QQE script [Re: SFF] #413882
12/19/12 11:14
12/19/12 11:14
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
Not only one, most likely. I estimate about 20 errors in your above script. What's the next error?

Re: QQE script [Re: jcl] #413883
12/19/12 11:18
12/19/12 11:18
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
Don't understand as It says the same error massage.

Re: QQE script [Re: SFF] #413885
12/19/12 11:26
12/19/12 11:26
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
Because you have still not understood what the error is. Please look at your script and answer the following questions:

- When do you need a series, and when do you need a variable?

- When do you add * and when not?

Re: QQE script [Re: jcl] #413889
12/19/12 11:47
12/19/12 11:47
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

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: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
Originally Posted By: SFF
- 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?

Originally Posted By: SFF
- 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?

Originally Posted By: SFF
- 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.

Page 1 of 2 1 2

Moderated by  Petra 

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