Download MetaTrader 5
To add comments, please log in or register
Are you accustomed to using the standard library? MQL5 has one!
stargazer
149
stargazer 2011.10.26 11:21 

I have this simple piece, but I found this difference on the tester. Can I use symbolinfo object during tester? Or is it this object only applies to current?

#include <Trade\SymbolInfo.mqh>

CSymbolInfo mysymbol;

Print("Obj Price = ",mysymbol.Ask(), " Price= ", SymbolInfoDouble(Symbol(),SYMBOL_ASK));

The result is:

2011.10.26 15:17:13    Core 1    2011.10.24 00:59:59   Obj Price = 0 Price= 1.38467
2011.10.26 15:17:13    Core 1    2011.10.24 00:59:40   Obj Price = 0 Price= 1.38467
2011.10.26 15:17:13    Core 1    2011.10.24 00:59:20   Obj Price = 0 Price= 1.38481
2011.10.26 15:17:13    Core 1    2011.10.24 00:59:00   Obj Price = 0 Price= 1.3848
2011.10.26 15:17:13    Core 1    2011.10.24 00:58:59   Obj Price = 0 Price= 1.38476
2011.10.26 15:17:13    Core 1    2011.10.24 00:58:40   Obj Price = 0 Price= 1.38469

willgart
842
willgart 2011.10.26 16:32  
stargazer:

I have this simple piece, but I found this difference on the tester. Can I use symbolinfo object during tester? Or is it this object only applies to current?

The result is:

2011.10.26 15:17:13    Core 1    2011.10.24 00:59:59   Obj Price = 0 Price= 1.38467
2011.10.26 15:17:13    Core 1    2011.10.24 00:59:40   Obj Price = 0 Price= 1.38467
2011.10.26 15:17:13    Core 1    2011.10.24 00:59:20   Obj Price = 0 Price= 1.38481
2011.10.26 15:17:13    Core 1    2011.10.24 00:59:00   Obj Price = 0 Price= 1.3848
2011.10.26 15:17:13    Core 1    2011.10.24 00:58:59   Obj Price = 0 Price= 1.38476
2011.10.26 15:17:13    Core 1    2011.10.24 00:58:40   Obj Price = 0 Price= 1.38469

I think you have to refresh the object first:

mysymbol.RefreshRates()

stargazer
149
stargazer 2011.10.26 17:02  
willgart:

tried that in this simpler script. doesnt work.... thx anyway for your response.

#include <Trade\SymbolInfo.mqh>


//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   CSymbolInfo *mysymbol=new CSymbolInfo;
   mysymbol.RefreshRates();
   Alert("tst ",mysymbol.Name());
   
   return;
  }
/
To add comments, please log in or register