MT4/MT5 data flow

 

I'm currently converting my EA from Pro Real Time to MT4. I'm currently an IG customer and I checked on the graph I'm using (GBPJPY M5) that both MT4 and PRT

are displaying the same quotation (ie : Bid, Ask are exactly the same). However when I look in the data window of MT4 and PRT. There are differences....

In fact MT4 seems to use the spot value to show Open Close High and Low information, whereas PRT seems to use Ask value to display Open Close High and Low.

As a consequence I systematically have a delta (Ask-Bid/2) between the MT4 data and PRT data. Then it is a problem for me to start coding my EA with values that are

different....Anyone has an idea about what i should do in MT4 to change this....?   

 

MT4 and MT5 has lots of bugs in documentation. But in MT4 "Client Terminal  /  Client Terminal Settings / Charts" help you can find:

  • Show ask line
    Bars in the terminal are built and shown only for Bid prices. However, for opening of long positions and closing of short ones, Ask price is always used. But it is not shown in the chart in any way, it cannot be seen. To control over one's trading activities more attentively, one can enable the "Show Ask line" parameter. After this command has been executed, an additional horizontal line corresponding with Ask price of the last bar will appear in the chart.
 

Dear Audrius


thanks for your answer, in fact I did activate the line for graphic purpose. But the thing is when I'm trying to program an EA, I encounter problems due to this delta.

For instance, the Moving Average function I'm using is using PRICE_CLOSE and this this price close is definitely the spot close....and not the Ask one. Therefore

the calculation is wrong....

 
In fact, I have investigated the fact that MT4 and MT5 use the Bid price to determine the Close Price. And Pro Real Time uses the Middle Price (ie : Bid + Spread/2). Therefore in order to convert my PRT EA to MT EA, I'll choose MT5 since it integrates the  notion of Spread. And in all the calculation I will do, I'll replace the Close price by the Bid + Spread/2 Price....As an example, if i need to use the iMA function, I'll use it like this: iMA(NULL,0,period,0,MODE_SMA,PRICE_MIDDLE_handle) where PRICE_MIDDLE_handle is my customized price enum. The problem is that I don't manage to define such a customized indicator even if it looks very simple.... If it would be a result of iMA or iRSI or other built in indicator it would be fairly direct, since the return of these functions are indicator handles (integer) that you can use directly in the above iMA formula as custom handle. But in my case, I just want to replace iClose (NULL,0,0) by iClose(NULL,0,0) + int(+iSpread(NULL,0,0)/2).....Can somebody tell me if this is feasible  ?
 
warren78: .Can somebody tell me if this is feasible  ?

Can't modify iMA (that's internal to the terminal.) Write or have written a new indicator (perhaps extending "Custom Moving Averages.mq4" or "AllAverages")


 
in the iMA command you have the ability to define a custom enum price. That is what I'm trying to use...
 
Actually, this is the same with iRSI, etc...I'm not going to rewrite all the functions, i'd like to use the custom enum price feature of MQL5.
 
  1. warren78: in the iMA command you have the ability to define a custom enum price. That is what I'm trying to use...
    Perhaps you should read the manual. Where do you see that?
    [in]  Applied price. It can be any of ENUM_APPLIED_PRICE enumeration values.
             iMA - Technical Indicators - MQL4 Reference

    ENUM_APPLIED_PRICE

    ID

    Value

    Description

    PRICE_CLOSE

    0

    Close price

    PRICE_OPEN

    1

    Open price

    PRICE_HIGH

    2

    The maximum price for the period

    PRICE_LOW

    3

    The minimum price for the period

    PRICE_MEDIAN

    4

    Median price, (high + low)/2

    PRICE_TYPICAL

    5

    Typical price, (high + low + close)/3

    PRICE_WEIGHTED

    6

    Weighted close price, (high + low + close + close)/4

              Price Constants - Indicator Constants - Standard Constants, Enumerations and Structures - MQL4 Reference

  2. warren78: i'd like to use the custom enum price feature of MQL5.

    Then start using MT5, you can't do it here.

 
I' m talking about MQL5
 
See my previous comments : Therefore in order to convert my PRT EA to MT EA, I'll choose MT5 since it integrates the  notion of Spread. And in all the calculation I will do, I'll replace the Close price by the Bid + Spread/2 Price.
 
warren78:
I' m talking about MQL5
Topic moved to mql5 section of the forum.
Reason: