Download MetaTrader 5

Incorrect casting of pointers -> i need help please

To add comments, please log in or register
jrbr
12
jrbr  

hello everybody

I can't keep an instancied object betwin 2 ticks. My object is created when an order is passed, and i want add informations when a new bar appear but i have this error : Incorrect casting of pointers in 'PositionObj.mqh'


the object seem not to exist but it is right instencied at the previous tick.


as global variable i have :

Position* position = NULL;


void OnTick()

{

...

// i add informations for each new bar

if (position != NULL)
    {
        position.ajouterIndicateur(HABarD);
        position.ajouterIndicateur(chandelier);

    }

...

if(!trade.PositionOpen(_Symbol,ORDER_TYPE_BUY, ...))
                Print(trade.ResultRetcodeDescription());

            position = new Position();
            position.ajouterIndicateur(HABarD);
            position.ajouterIndicateur(chandelier);

}


my object "position" seem not to exist for the 2nd passed in "onTick()"


anyone can help me ?

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
Ilyas
1205
Ilyas  
Thanks, I will check it.

Ilyas
1205
Ilyas  
Can you attach your source codes via private message.
MQL5.community - User Memo
  • 2010.02.25
  • MetaQuotes Software Corp.
  • www.mql5.com
You have just registered and most likely you have questions such as, "How do I insert a picture to my a message?" "How do I format my MQL5 source code?" "Where are my personal messages kept?" You may have many other questions. In this article, we have prepared some hands-on tips that will help you get accustomed in MQL5.community and take full advantage of its available features.
To add comments, please log in or register