Hi there,
I am trying to get the current 'Open', 'High', 'Low', 'Close' prices.
I tried implementing the below code in onData function.
price = data["EURUSD"].Price
Any idea what does the price refers to and how exactly can i get the OHLC prices for the current day?
Thanks in advance
Jing Wu
Forex has quote bar data with bid and ask price. You need to specify the bid or ask price of OHLC. For example
de OnData(self, data):    bid_open = data[symbol].Bid.Open    ask_low = data[symbol].Ask.Low # the mid price of bid close and ask close close = data[symbol].Close # this is also the close price price = data[symbol].Price
The formula is
data[symbol].Close = (data[symbol].Bid.Close + data[symbol].Ask.Close) * 0.5
data[symbol].Close = data[symbol].Price
Zheng Jie Sung
Thank you so much!
Zheng Jie Sung
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!