I have a small confusion- Please help me on this as I m little new to Automating trading I cant understand one thing - When i call historical data (be it of any interval), I get the data till that particular time. Suppose I assign it to a variable [spy= spy-OHLC for 5 min interval] and when I call spy, it will everythime give me same data. This is good for back testing. But when I want to trade in live market where I would require some historical data to apply logic and than take it to live amrket for 'that same Interval' how do I do it? Brokers' do provide WebSockets for live streaming data. But then it is simply TBT and not interval wise OHLC. What is the solution for this Thanks in advance
Wut? Are you confusing live streaming with a real time data feed? Don't you just need the current 5 min interval in addition to the historical ones?
Real-Time Data Feed from a broker would give Tick Data and not OHLC Apart from I converting TD to OHLC, is there any other way?
OHLC is easy to build. Open is first tick in current 5 min interval High is either current price if higher than previous ticks in the current 5min interval Low is similar Close is current price... That's the way the current 5 min candle/bar etc is build.
But how to go about building the OHLC? I mean The data that we receive from Broker end which is live and streaming, how shall we take it and where? Can you help me the code plz?
Better you start with basics of programming. The most basic solution: Use an array with certain type of structures/objects for historical OHLC and one separate structure, which might be of identical type to the structures/objects in the array to store your current bar, as suggested by JackRab. When done (next OHLC bar), append/insert at end it to array.