Unexpected token" error when declaring a struct using typedef
There is no need to use the "typedef". Just simply use the "struct" and simplify it!
struct TPSLprices { double SLprice, TPprice; };
typedef struct TPSLprices{ double SLprice; double TPprice; }TPSLprice;
it's still giving me the same error.
'Unexpected Token' TPSLprice
And when I am trying to declare the struct as you suggested then simplifying it as follows
struct TPSLprices { double SLPrice, TPprice; }; typedef struct TPSLprices TPSLprice;
It gives the following error:
'TPSLprices' - identifier aready used
Why are your trying to define a new type?
Just use the the original structure type name in the rest of your code. I already stated, that there is no need to use "typedef" in this case.
This is not "C". This is MQL. It works a little differently!
EDIT: To make it more clear for you - you can't use "typedef struct" in MQL!
Don't use typedef; you can't even use typedef double Price. It is unimplemented except for pointer to a class method.
More exactly pointer to a function, it doesn't work for a class method either.
In fact it's possible to assign a static class method to a suitable function pointer.
Hello I am getting this strange error for me when I define a struct like in the image using typedef.
Can anyone help me with what is the "unexpected token" erros and how to fix this ??!
Thanks a lot in advance.