How to calculate the Close and Open price of candle?
  #1 (permalink)  
Old 09-01-2005, 04:20 PM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,922
Thanks: 97
Thanked 361 Times in 147 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default How to calculate the Close and Open price of candle?

Hey,

I'm a little stuck here while making a modification in broker interface. Now I need to write a function that correctly recalculate the OHLC prices of candles in metatrader platform.

Metatrader 3 chart combines both Bid and Ask price in the same candle (High of candle is the highest ask price, Low is the lowest bid price, Open and Close = Bid + Ask / 2). What I'd like to do here is to recalculate candle OHLC to be based in Bid price only. It seems easy, but...

The problem here is how to calculate the Open and Close price when the result of Bid + Ask / 2 is need to be round up (has a value smaller in a pip). Example, Bid + Ask /2 of EURUSD = 1.24485. This price cannot be display on chart, so what is the way to round it? I've observed this for a day now, and i'm still very confused. Sometimes, MetaTrader round it down to 1.2448, but sometimes round it up to 1.2449.

Hope you can help me with this.
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.

Last edited by scorpion : 09-01-2005 at 04:23 PM.
Reply With Quote
  #2 (permalink)  
Old 09-07-2005, 03:51 AM
gazuz's Avatar
Senior Trader and Moderat
 
Join Date: Aug 2004
Posts: 768
Thanks: 1
Thanked 8 Times in 5 Posts
gazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to all
Default

isnt the difference between bid and ask alwasy 2 pips? for example the Ask = Bid+2 and Bid = Ask-2 I think thats what I understood last time I checked...
__________________
____________________________\¦/
___________________________(ò ó)
______________________o0o___(_)___o0o__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
Reply With Quote
  #3 (permalink)  
Old 09-07-2005, 04:44 AM
Ravique's Avatar
Super Moderator
 
Join Date: Sep 2004
Posts: 404
Thanks: 2
Thanked 1 Time in 1 Post
Ravique is a name known to allRavique is a name known to allRavique is a name known to allRavique is a name known to allRavique is a name known to allRavique is a name known to all
Send a message via Yahoo to Ravique
Default

as far as i heard the difference between bid and ask price is the spread. if it is 2 then its 2 , if 4 then 4 and so on.
__________________
Regards,
Ravique
Reply With Quote
  #4 (permalink)  
Old 09-07-2005, 05:12 AM
gazuz's Avatar
Senior Trader and Moderat
 
Join Date: Aug 2004
Posts: 768
Thanks: 1
Thanked 8 Times in 5 Posts
gazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to all
Default

Quote:
Originally Posted by Ravique
as far as i heard the difference between bid and ask price is the spread. if it is 2 then its 2 , if 4 then 4 and so on.
Ooops i was concentrating on Interbankfx's EUR/USD which is 2. Yeh I saw that ask - bid = spread
__________________
____________________________\¦/
___________________________(ò ó)
______________________o0o___(_)___o0o__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
Reply With Quote
  #5 (permalink)  
Old 09-07-2005, 06:30 AM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,922
Thanks: 97
Thanked 361 Times in 147 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default

You don't understand what I said. Let's take a close-up look on how MetaTrader display the Close price of the last candle in EURUSD chart.

I thought MetaTrader display the latest Close price = (latest Bid + latest Ask) / 2. Example 1: Bid = 1.2000, Ask = 1.2002, then Close = 1.2001. But what if the spread is 3 pips. Example 2: Bid = 1.2000, Ask =1.2003, then Close = 1.20015. Have you seen MetaTrader displayed 1.20015 (it contains undisplayable 0.5 pip) in EURUSD chart? never. It's because MetaTrader rounds up the price to a displayable price.

I figured it out last two days that MetaTrader uses the Normalize() function to round up the undealable or undisplayable price. That for sure means Close = Normalize((Bid + Ask) / 2).

What I wanted to do here is to reverse Close price back to Bid. This means I have to reverse the price rounding (denomalize). Unfortunately reverse the priceing rounding is only 50% accurate which is unacceptable.
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
  #6 (permalink)  
Old 09-07-2005, 02:05 PM
gazuz's Avatar
Senior Trader and Moderat
 
Join Date: Aug 2004
Posts: 768
Thanks: 1
Thanked 8 Times in 5 Posts
gazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to all
Default

I get what you mean, sorry I couldn't help
__________________
____________________________\¦/
___________________________(ò ó)
______________________o0o___(_)___o0o__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing trades at end of candle TraderSeven MetaTrader and ZeroCode 2 09-22-2005 02:53 PM


All times are GMT. The time now is 11:10 PM.
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0

Registered members have access to special online forex currency trading tools, software, mt4 expert advisors and indicators. Register now