I'm slowly learning MQL4 and I would prefer to learn for myself rather than have everything handed to me on a platter. If anyone can help me on the following sticking point, that would be greatly appreciated.
I am basically trying to display the current exchange rate of a particular currency pair as a Comment at the top left. Here is what I have so far:
<CODE DELETED>
I know this is a very simple problem but as somebody who only started learning MQL4 a few days ago, this is a mountain of a task! I'm not even sure if iClose was the right thing to choose.
Please edit your post . . .
I'm slowly learning MQL4 and I would prefer to learn for myself rather than have everything handed to me on a platter. If anyone can help me on the following sticking point, that would be greatly appreciated.
I am basically trying to display the current exchange rate of a particular currency pair as a Comment at the top left. Here is what I have so far:
I know this is a very simple problem but as somebody who only started learning MQL4 a few days ago, this is a mountain of a task! I'm not even sure if iClose was the right thing to choose.
Code in init() just gets called when the Indicator/EA foirst runs or is re-initialised, your code should go in start()
The current price of the symbol that your code is running on is Bid, if you specifically want the Bid price for a different symbol you can use MarketInfo() with MODE_BID
Code in init() just gets called when the Indicator/EA foirst runs or is re-initialised, your code should go in start()
The current price of the symbol that your code is running on is Bid, if you specifically want the Bid price for a different symbol you can use MarketInfo() with MODE_BID
Thanks for letting me know about both SRC and Marketinfo() :)
Please edit your post . . .
Nice done Simon this explanation how to use SRC button
And on other news, I completed my Comment-based lot size calculator. A very proud moment for me!
I wish you happy trades :)
And on other news, I completed my Comment-based lot size calculator. A very proud moment for me!
I wish you happy trades :)
Not sure, lol
When I was reading C for dummies, the author said that step 1 was to think of something to programme and that it was also the hardest step! I think I have to agree.
int init(){ double eurate=iClose("EURUSD",0,0);
Don't try to use any price (or indicator) or server related functions in OnInit (or on load or in OnTimer before you've received a tick), as there may be no connection/chart yet:
- Terminal starts.
- Indicators/EAs are loaded. Static and globally declared variables are initialized. (Do not depend on a specific order.)
- OnInit is called.
- For indicators OnCalculate is called with any existing history.
- Human may have to enter password, connection to server begins.
- New history is received, OnCalculate called again.
- New tick is received, OnCalculate/OnTick is called. Now TickValue, TimeCurrent, account information and prices are valid.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm slowly learning MQL4 and I would prefer to learn for myself rather than have everything handed to me on a platter. If anyone can help me on the following sticking point, that would be greatly appreciated.
I am basically trying to display the current exchange rate of a particular currency pair as a Comment at the top left. Here is what I have so far:
I know this is a very simple problem but as somebody who only started learning MQL4 a few days ago, this is a mountain of a task! I'm not even sure if iClose was the right thing to choose.