Forum

Manage per tick execution and use of market data efficiently

Hi, I'm writing an EA that will mostly use daily updating signals (i.e. market data is PERIOD_D1) but the EA will then select an appropriate time intra-day to trade (i.e. will need to make a per tick decision, until the trade is made) There is clearly no need to update the daily signals and daily

Advice and examples of MQL5 code using Standard Libray CIndicator and CTrade classes

Hi, I'm trying to write the simplest EA in MQL5 and it's really not a fun experience. Firstly I tried to write the EA from the ground up and find it incredibly cumbersome to do even the simplest things, for example to get a couple of prices: // get yesterday's open and close price MqlRates

Working with bar returns in MQL5

Hi, Sometimes I like to think in daily returns for a security (!) So for instance, I'd like to know the volatility ( standard deviation ) of the last year of daily returns of EURUSD. Unfortunately I cannot find a quick way to get this in MQL5. iSTD will give me the standard deviation of the PRICE of

MQL5 Positions with multi stop loss targets

Hi, I just switched from MT4 to MT5 and what a pain converting from MQL4 to MQL5. A major problem I cannot solve is how to have several orders (MT4) in the same symbol each with a different stop loss (SL). E.g. Order 1, buy opened at 1.22, SL 1.20 Order 2, buy opened at 1.25, SL 1.22 Order 3, buy

Missing price when retrieve all symbols using SymbolsTotal() and SymbolName()

Hi, I'm trying to cycle through all the symbols that are available in MT4. Not just the symbols that are currently displayed in MarketWatch. I use the following (abridged) code: int numSymbols= SymbolsTotal ( false ); string symbol= SymbolName (PositionIndex, false ); double price= MarketInfo

Swap Calculation issues

Hi, I know this has come up many times before but I still cannot work out a generic way to calculate the account currency swap (typically USD) for ANY symbol (whether currency, commodity, equity, etc.) See below for example code which leaves a lot of questions. Here are some: (1) why is Tick Value

How to get the FX order value in Deposit currency

Hi, I'm used to thinking of currency trades in USD notional exposure (i.e. 100,000 lots of TRYZAR would be 28,400 USDZAR) And USD would be my deposit currency. Is there an easy way to get USD exposure (or deposit currency exposure) from FX orders in MQL4? I've had a good look at the Order functions

MQL4 EA defaults to symbol at top of Market Watch window

Hi, I'm a relative newbie to MQL4 (but not programming). I have created a new EA. I find when I run the EA it somehow defaults to the symbol at the top of the Market watch window, in this case USDCHF. I.e. the Symbols() function returns USDCHF. The output in the Experts window also refers to USDCHF