Pointer expected

Posted By: edilsonfsantos

Pointer expected - 09/28/16 12:30

Hi all,
I am trying the following code:

//---------------------------------------------
#include <profile.c>

function run()
{
BarPeriod = 40; // 6 hour bars
//settings parameters and indicators

var* Price = series(price());
int emaper = optimize(9, 14, 21);
int xatr = 1;
int numatr = 3;
int numback = optimize(5, 2, 6);
//weigth indicator by volatility
vars TrendLine = ((EMA(Price[0],emaper) / EMA(Price[numback],emaper)) - 1) / xatr * ATR(numatr);

//-----------------------------------------------------

But when I go "test" in Zorro appear this error.


Zorro 1.50.6 Trading Automaton
Made with Gamestudio by oP group 2015


TFscript compiling.........
Error in 'line 17:

EMA(): Pointer expected
< vars TrendLine = ((EMA(Price[0],emaper) / EMA(Price[numback],emaper)) - 1) / xatr * ATR(numatr);
>.

Someone can help me?

Best
Edilson
Posted By: rayp

Re: Pointer expected - 09/28/16 12:39

Moved this to zorro.
greets
Posted By: MatPed

Re: Pointer expected - 09/28/16 13:11

Not sure, but try to change price[0] in price. Ema need a serie to be calculated.

Ciao
Posted By: edilsonfsantos

Re: Pointer expected - 09/28/16 23:08

Originally Posted By: rayp
Moved this to zorro.
greets


I do not understand...
Here is "Starting with Zorro"?

Best
Edilson
Posted By: edilsonfsantos

Re: Pointer expected - 09/28/16 23:15

Originally Posted By: MatPed
Not sure, but try to change price[0] in price. Ema need a serie to be calculated.

Ciao


Ok. I re-code.
----------------------
function run()
{
BarPeriod = 40; // 6 hour bars
//settings parameters and indicators

var* Price = series(price());
int emaper = optimize(9, 14, 21);
int xatr = 1;
int numatr = 3;
int numback = optimize(5, 2, 6);
//weigth indicator by volatility
var EMA1 = EMA(Price, emaper);//EMA calculated with series()
vars TrendLine = ((EMA1[0] / EMA1[numback]) - 1) / (xatr * ATR(numatr));
---------------------------------------------------
Zorro 1.50.6 Trading Automaton
Made with Gamestudio by oP group 2015


TFscript compiling.........
Error in 'line 18:
subscript requires array or pointer type
< vars TrendLine = ((EMA1[0] / EMA1[numback]) - 1) / (xatr * ATR(numatr));
>.

Best
Edilson
Posted By: edilsonfsantos

Re: Pointer expected - 09/29/16 07:30

Hi.
I have the solution.
"Ema needs a serie() to be calculated".
Thanks
Edilson
Posted By: Grat

Re: Pointer expected - 09/29/16 08:40

hi,

try change this:

var* Price = series(price());

to

vars Price = series(price());
Posted By: jcl

Re: Pointer expected - 09/29/16 08:54

var* and vars is the same, but var and vars is not. Thus, "vars Trendline" is wrong.
© 2024 lite-C Forums