MQL5 CopyLow returns Bid prise

 

Hi

I code a trailingfunktion below one of the last candles. But
this code returns the lowest Bid price - fine so far but i need the Ask price.

 

double   lowest = 0;  
int      TrailingCandles = 2;
int minIdx;


   //-- Tiefpreis aus X(TrainilgCandles) Candels
         double low[];
         ArraySetAsSeries(low,true);
         CopyLow(_Symbol,PERIOD_D1,0,10,low);
         minIdx = ArrayMinimum(low,0,TrailingCandles);
         lowest = low[minIdx];


I can't find where ti adjust Ask/Bid - when i tried with CopyHigh it also returns the Bid price.

Any ideas? Thank you.

 
Zar88:

Hi

I code a trailingfunktion below one of the last candles. But
this code returns the lowest Bid price - fine so far but i need the Ask price.

 

double   lowest = 0;  
int      TrailingCandles = 2;
int minIdx;


   //-- Tiefpreis aus X(TrainilgCandles) Candels
         double low[];
         ArraySetAsSeries(low,true);
         CopyLow(_Symbol,PERIOD_D1,0,10,low);
         minIdx = ArrayMinimum(low,0,TrailingCandles);
         lowest = low[minIdx];


I can't find where ti adjust Ask/Bid - when i tried with CopyHigh it also returns the Bid price.

Any ideas? Thank you.

It does not return the lowest Bid price

It returns the lowest close price for certain bar - those are OHLC (open,high,low and close) not Bid/Ask values. You do not have historical Bid and/or Ask values

 
Close price was a Bid or a Ask befor - there is not one price, there is always a spread - does not make a sense to me? 

//-- haha: if you know a no-spread broker please tell me i am veeeery interested ;-) 

When you try the code on a 1M chart you find out that the return is the lowest Bid of all TrailingCandels.
I deald with fxcm tradingstation2 befor, there you can switch between Bid and Ask chart - looks like
MT5 does not do this. So the ClosePrice seams to be the CloseBidPrice ???
 
Zar88:
Close price was a Bid or a Ask befor - there is not one price, there is always a spread - does not make a sense to me? 

//-- haha: if you know a no-spread broker please tell me i am veeeery interested ;-) 

When you try the code on a 1M chart you find out that the return is the lowest Bid of all TrailingCandels.
I deald with fxcm tradingstation2 befor, there you can switch between Bid and Ask chart - looks like
MT5 does not do this. So the ClosePrice seams to be the CloseBidPrice ???

What does not make a sense?

Bid and Ask prices do not have to be the same as close price at all. That all depends on your broker

A bid price is the highest price that a buyer (i.e., bidder) is willing to pay for a good. It is usually referred to simply as the "bid".

Ask price, also called offer price, offer, asking price, or simply ask, is the price a seller states she or he will accept.
 
you mean - Real account ? No only testaccount.
 
Zar88:
you mean - Real account ? No only testaccount.
Aren't you confusing prices and account types? Please re-read previous posts - none of the told depends on the account type
 
Yep, the question was if i chequed it on runtime - post is not there anymore maby a mql5.com bug - move on on Bid/Ask anyway....

Here my thinking:
Because the chart plots a Bid price based draw - my "lowest price" is a Bid. 
So CopyLow() returns the "Historical Bid" ... it looks like MT5 draws only Bid charts ???

A Ask based chart would look slightly different . I know this for 100% because i worked
with tradingstation2 that can do Bid/Ask Charts.

Is the question it clear so far? 

greez....
 
Zar88:
Yep, the question was if i chequed it on runtime - post is not there anymore maby a mql5.com bug - move on on Bid/Ask anyway....

Here my thinking:
Because the chart plots a Bid price based draw - my "lowest price" is a Bid. 
So CopyLow() returns the "Historical Bid" ... it looks like MT5 draws only Bid charts ???

A Ask based chart would look slightly different . I know this for 100% because i worked
with tradingstation2 that can do Bid/Ask Charts.

Is the question it clear so far? 

greez....

I will try once more : check the market watch and on some brokers compare what you see (and think) that is a bid price. That price does not have to be bid price at all. It all depends on your broker (and the type of your broker)

Is that clear so far?

 
Zar88:
Yep, the question was if i chequed it on runtime - post is not there anymore maby a mql5.com bug - move on on Bid/Ask anyway....

Here my thinking:
Because the chart plots a Bid price based draw - my "lowest price" is a Bid. 
So CopyLow() returns the "Historical Bid" ... it looks like MT5 draws only Bid charts ???

A Ask based chart would look slightly different . I know this for 100% because i worked
with tradingstation2 that can do Bid/Ask Charts.

Is the question it clear so far? 

greez....

There is no ask charts with MT5.

There is no historical ask with MT5.

However the spread is available for each 1 minute bar, so you can estimate your ask price.

 
Chart prices are always the Bid price.
 
@ Alain
Then the Solution is =>i need to take Bid and add spread myself to simulate an Ask.

Looked to me like a "un-"cleanest way to do .... but knowing that there is no AskHistory
i can make it work this way - thanx....
Reason: