CDealInfo does not work in the strategy tester? - page 2

 
karp wak:

Ok i changed PositionsTotal() by HistoryDealsTotal()... but it still not working :-(

You should stop to guess and start reading and learning the documentation.
Orders, Positions and Deals in MetaTrader 5
Orders, Positions and Deals in MetaTrader 5
  • www.mql5.com
Creating a robust trading robot cannot be done without an understanding of the mechanisms of the MetaTrader 5 trading system. The client terminal receives the information about the positions, orders, and deals from the trading server. To handle this data properly using the MQL5, it's necessary to have a good understanding of the interaction between the MQL5-program and the client terminal.
 
Btw, ArrayResize ist one to small...
 
Alain Verleyen:
You should stop to guess and start reading and learning the documentation.
Yes, I've been doing this for a while and it was all very confusing. I was able to observe a kind of transition time between MQL4 and MQL5. And finally a few days ago I discovered the "Trade Classes" and the doors of heaven were opened to me. Thanks developers for doing this !!
 
Dominik Egert:
Btw, ArrayResize ist one to small...

Yes, I am looking for some function that allows me to allocate an array in memory.

Something like this in C ++:
double * array = new double [size];

But for some reason that I can't understand, this is not working in MQL5 ...

 

karp wak:

Dominik Egert:
Btw, ArrayResize ist one to small...

Yes, I am looking for some function that allows me to allocate an array in memory.

Something like this in C ++:
double * array = new double [size];

But for some reason that I can't understand, this is not working in MQL5 ...

You must learn to read the documentation: ArrayResize()
Documentation on MQL5: Array Functions / ArrayResize
Documentation on MQL5: Array Functions / ArrayResize
  • www.mql5.com
ArrayResize - Array Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Fernando Carreiro:
You must learn to read the documentation: ArrayResize()
I will!! Thanks you so much Fernando!!
 
Concerning ArrayResize and it's second parameter. It's the same in any language.

Indexing goes from 0 to X. The last available index is size of array -1.

So if you resize, you say ie 10, then your index goes from 0-9.

As an example ArraySize or OrdersTotal gives you the exact size you need to use as parameter for ArrayResize. Do not subtract 1.


 
Dominik Egert:
Concerning ArrayResize and it's second parameter. It's the same in any language.

Indexing goes from 0 to X. The last available index is size of array -1.

So if you resize, you say ie 10, then your index goes from 0-9.

As an example ArraySize or OrdersTotal gives you the exact size you need to use as parameter for ArrayResize. Do not subtract 1.


I understand it. Thanks for your help Dominik.

Reason: