double bid=(int)MarketInfo(Symbol(),MODE_BID);
-
Bid is not an int. Fails on almost all symbols.
PIP, Point, or Tick are all different in general.
What is a TICK? - MQL4 programming forum #35 (2014)Unless you manually adjust your SL/TP for each separate symbol, using Point means code breaks on 4 digit brokers, exotics (e.g. USDZAR where spread is over 500 points), and metals. Compute what a PIP is and use it, not points.
How to manage JPY pairs with parameters? - MQL4 programming forum (2017)
Slippage defined in index points - Expert Advisors and Automated Trading - MQL5 programming forum (2018) - 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.
- A new tick is received, OnCalculate/OnTick is called. Now TickValue, TimeCurrent, account information and prices are valid.
thank you, I'm talking about the expiry date, I added that there, and it has a problem with the return
void OnInit() { ⋮ return(INIT_SUCCEEDED);
No, you're not. Your problem is a void OnInit(). Void functions can not return values.
The OnInit() function of the void type always denotes successful initialization.
Event Handling Functions - Functions - Language Basics - MQL4 Reference
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use