I'm just trialling AMIBroker as I had i recommended to me for backtesting (I have been building my own backtest system but needed to get moving faster!).
I'm trying to import my price data (CSV format) and I manage to import Open, Hight, Low, Close BUT I can only import either my BID prices OR my OFFER prices, not both - I wonder if I'm missing something?
The spread is important to me as it makes a difference to my profit (or loss!).
If anyone can point me towards how to import both prices that would be very helpful - thanks.
This seems like a weird way to format data. Generally if someone wants bid ask data they have tick data which is every trade on an instrument. Then perhaps the data provider gives the bid/ask data and it’s simple to import it under aux1 and aux2 data.
In Amibroker you have Open, High,Low, Close ,volume, open interest and aux1 and aux2 as time series data.
I have no idea how your approach building a database with your data. I can see if the bid/ask at open and close of a minute bar being perhaps useful. But knowing the bid/ask at the high and low provides no real benefit as that’s hindsight knowledge.
Generally when I’m testing I just assume it’s the slippage bid/ask and compare backtest to live samples and compare.
Ticks still have open/high/low/close. Depending on the size of the trade, that tic can take out multiple prices. Generally you’ll see a small lot just have the same OHLC value. Then use aux1 and aux2 for bid/ask at the time of that tick.
here's what my raw tick data looks like, sometimes there's 10+ prices per second, sometimes there's only a few every minute:
Instrument, date, time, bid, offer
So it sounds like to get it into AMIBroker I should take say the BID price (column 4), duplicate it to make it OPEN_BID, HIGH_BID, LOW_BID & CLOSE_BID, then put the offer into Aux 1 column (or I could calculate the difference between bid & offer i.e. the spread and but that in Aux 1)?
Then when writing my backtesting code I can make sure I always buy at the OFFER and sell at the BID (for long positions)? That way my profit calculation will always have accounted for the loss due to the spread.
No, you do not have to duplicate anything inside file.
1-tick is single value. It is not OHLC.
If you import 1-tick data then you only need to import to close field (either bid or ask).
The OHL fields get populated with same 1-tick value per timestamp.
1-tick is single value and so O==H==L==C always.
Then if changing interval in AB OHLC bars (e.g. 1-min, 5-min, 10R, etc) are created out of that base interval 1-tick.
Also you need to enable $TICKMODE 1 of ASCII importer (if you need duplicate timestamp data). So if your file contains duplicate timestamp(s) (rows with same date and time) then duplicate stamps data will be imported to AB.
And FYI... yes, sub-second data is supported by AB too.
So one way is to import bid to Close field, ask data to Aux1 and Volume to Volume field.
Then you can use timeframe functions to compress to longer intervals such as 1-min, 5min, Hourly... (e.g. if trying to exit at profit/loss target levels).
Or you do as I have explained in my previous post of this thread. First import bid data to Symbol_Bid (to close field) then import ask data to Symbol_Ask (to close field). Then use SetForeign(). That way for both bid and ask data OHLC bars are created out of 1-tick. And of course you may still use time frame functions looking from 1-tick level, too.
As aside please read the pinned thread How to ask good question.
You said the whole time (before) that you have EOD data ("my 1-day OHLC data") with bid and ask info for OHLC fields. Also you have shown EOD data (one row per day in your picture). So if you would have explained correctly right at the start (which means taking time to create post) then you would not have made others wasting time with multiple posts. You expect others taking time for you and getting detailed response by others. So please take your time too to create post containing all info at start.