Metatrader known bugs ... - page 110

 

Metatrader 5 :

ArrayMinimum() and Arraymaximum() functions are ignoring the set as series setting (regardless of the help file that tells differently). It can cause future values readings and. that way, repainting

 
mladen:
Metatrader 5 : ArrayMinimum() and Arraymaximum() functions are ignoring the set as series setting (regardless of the help file that tells differently). It can cause future values readings and. that way, repainting

Reorganizing members of an array virtually is excellent source of bugs, and will be.

 
apprentice coder:
Did you solve the issues?

I used solution 2, quoted in #1096 above. As the broker I tested on had hundreds of pairs and stocks etc., I initialized it to 1000.

Big Be

 

Bid Price Problem, Looking at

See also Posts 338, 343

This is not a new issue, but I wrote a line to compare three ways of looking at the Bid price. On

a Windsor Direct demo account, the only one that agrees with the Bid line on the chart is the thirdone.

Comment(" Bid ",DoubleToStr(Bid, Digits), " MarketInfo ",DoubleToStr(MarketInfo(NULL, MODE_BID),

Digits), " Close ",DoubleToStr(iClose(NULL, 0, 0), Digits)) );

(If you put it at or near the end of the Start() function of an indicator (temporarily) it should overwrite any other Comments in that indicator.)

In this same broker account, with Show Ask line on, the Ask was wrong by exactly the same amount as the Bid.

To get an accurate Ask, one could take the Close:

CurrentPrice = iClose(NULL, 0, 0);

then add to it the spread, computed thusly:

mySpread = MarketInfo(NULL, MODE_ASK) - MarketInfo(NULL, MODE_BID);

Then:

myAsk = CurrentPrice + mySpread;

(MarketInfo is reputed to be more reliable the Ask-Bid. I don't know the reliability of MODE_SPREAD [or MODE_SPREAD*Point].)

Note: Use NormalizeDouble on prices for use in EAs where opening or modifying trades:

mySpread = NormalizeDouble(mySpread , Digits);

This expanded Comment adds the Ask and Spread as well:

Comment(" Bid ",DoubleToStr(Bid, Digits), " MarketInfo ",DoubleToStr(MarketInfo(NULL, MODE_BID),

Digits), " Close ",DoubleToStr(iClose(NULL, 0, 0), Digits), " Ask ",DoubleToStr(Ask, Digits), " Spread ",DoubleToStr(Ask-Bid, Digits) );

I would be interested to know which Bid method agrees with the Bid line on yourbrokers, live or demo.

Big Be

Note: I deleted the indicator after the Comment appeared.

Files:
 
Big Be:
Bid Price Problem, Looking at

...

I would be interested to know which Bid method agrees with the Bid line on yourbrokers, live or demo.

It is easy, Bid is constant until the next OnTick run or RefreshRates(). MarketInfo(NULL, MODE_BID) is always the last known bid price. Close[0] is aligned with the bid line in the chart, but may differ from the trading bid. The ask line in the chart is a complete mystery.

askbidline.mq4

Files:
 
Big Be:

I used solution 2, quoted in #1096 above. As the broker I tested on had hundreds of pairs and stocks etc., I initialized it to 1000.

Big Be

Why using fixed size arrays?

 
apprentice coder:
Why using fixed size arrays?

I'm not. Please re-study my post. Terms used are explained in MetaEditor Help.

 
Ovo:

It is easy, Bid is constant until the next OnTick run or RefreshRates(). MarketInfo(NULL, MODE_BID) is always the last known bid price. Close[0] is aligned with the bid line in the chart, but may differ from the trading bid. The ask line in the chart is a complete mystery.

Ovo,

Thank you, and thank you for your utiity. I added my Comment line above to it.

This brings to mind several more questions:

Do you know WHY Close[0] and the bid line in the chart, may differ from the trading bid?

On the platform mentioned above, Windsor Direct Demo, the Bid is a half pip below chart bid, and Ask is a half pip above chart Ask.

Is this a way to take an extra pip without telling us or just an MT oddity?

Do you know if it is on all brokers or only some?

In your experience, is one of the data (Bid, MarketInfo, Close[0]) consistently more reliable?

Which would you use in an EA?

Thank you,

Big Be

 
Big Be:

Ovo,

Thank you, and thank you for your utiity. I added my Comment line above to it.

This brings to mind several more questions:

Do you know WHY Close[0] and the bid line in the chart, may differ from the trading bid?

On the platform mentioned above, Windsor Direct Demo, the Bid is a half pip below chart bid, and Ask is a half pip above chart Ask.

Is this a way to take an extra pip without telling us or just an MT oddity?

Do you know if it is on all brokers or only some?

In your experience, is one of the data (Bid, MarketInfo, Close[0]) consistently more reliable?

Which would you use in an EA?

Thank you,

Big Be

It is not about reliability. It depends, whether you work with the chart or with orders. Indicator graphics should always work with Close values, so Close[0] is correct here. EA is mixed, it usually reads levels from the chart (directly or via indicators). You should apply the shift to OHLC prices when using them in trading orders. The shift (Close[0]-Bid) is constant, from my experience, except the first few seconds after MT4 starts, when charts are still loading.

The reason is - a single charts feed for multiple account types; and it appears more often with live accounts than demo.

 
Big Be:

I'm not. Please re-study my post. Terms used are explained in MetaEditor Help.

I initialized it to 1000.

Isn't that a fixed size?

Reason: