Forex Forum - EarnForex
Serving Traders Since 2005
 

Go Back   Forex Forum - EarnForex > MetaTrader > MetaTrader 5

MetaTrader 5 MT5 is already out of its beta stage, but the development is ongoing. Some brokers already offer real accounts and the interest of traders is growing. You can discuss anything related to MetaTrader 5 in this forum.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 27th October 2011, 21:55
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default rates

Hi

I am not getting the last price with this code, is there a problem?

thx

MQL5 Code:
      string names[5];
      names[0]=("EURUSD");
      names[1]=("GBPUSD");
      names[2]=("USDCHF");

for(uchar i=0;i<ArraySize(names);i++)
  {
      double deal_last; SymbolInfoDouble(names[i],SYMBOL_LAST,deal_last);  
      FileWrite(filehandle,names[i],deal_last);
  }
Reply With Quote
  #2 (permalink)  
Old 28th October 2011, 13:03
Enivid's Avatar
Administrator
 
Join Date: Nov 2008
Posts: 1,548
Thanks: 18
Thanked 20 Times in 16 Posts
Default

And what are you getting instead of the last price?
__________________
Please, read the Forum Rules and the Signature Rules to avoid termination of your account.
Reply With Quote
  #3 (permalink)  
Old 28th October 2011, 15:47
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default

0
0
0

the code is placed in the OnInit()

Last edited by samjesse; 28th October 2011 at 15:54.
Reply With Quote
  #4 (permalink)  
Old 28th October 2011, 16:11
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default

MQL5 Code:
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
   ...
  {
 
     double d; SymbolInfoDouble(_Symbol,SYMBOL_LAST,d);
     Print(d);

prints:
0
0
...
0
Reply With Quote
  #5 (permalink)  
Old 28th October 2011, 20:02
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default

SYMBOL_BID and SYMBOL_Ask works fine.

does the chart use bid or ask to chart the bars?
Reply With Quote
  #6 (permalink)  
Old 28th October 2011, 21:27
Enivid's Avatar
Administrator
 
Join Date: Nov 2008
Posts: 1,548
Thanks: 18
Thanked 20 Times in 16 Posts
Default

SYMBOL_LAST - Price of the last deal

I guess it's for the stock/futures/etc trading where the broker has access to the last deal price. Not for Forex.
__________________
Please, read the Forum Rules and the Signature Rules to avoid termination of your account.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
InstaChange - Electronic Exchange Rates InstaChange Advertisements 0 28th May 2011 12:01
Australia Changes Its Rates alessio09 Forex News 3 7th November 2009 15:39
Will Australia Raise Interest Rates? Sir Forex Advertisements 0 18th October 2009 19:34
Australian Dollar to Come ‘Under Pressure’ on Rates, RBS Says Enivid Forex News 1 22nd April 2009 09:14
Dollar Trades Near Two-Month Low as Fed Poised to Cut Rates Enivid Forex News 0 16th December 2008 09:10


All times are GMT. The time now is 11:23.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Inactive Reminders By Icora Web Design

SEO by vBSEO 3.3.2