Symbol.Ask, Symbol.Bid, MarketSeries.Close.LastValue

Created at 10 Mar 2015, 15:35
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
TR

traderan

Joined 10.03.2015

Symbol.Ask, Symbol.Bid, MarketSeries.Close.LastValue
10 Mar 2015, 15:35


Hello,

I have noticed a serious issue with these data: Symbol.Bid and MarketSeries.Close.LastValue.

I am using MarketSeries.Close.LastValue value as last traded price.

and MarketSeries.TickVolume.LastValue as last traded volume.

I am printing Symbol.Ask, Symbol.Bid and MarketSeries.Close.LastValue on every tick and noticed that MarketSeries.Close.LastValue and Symbol.Bid values are always same and also MarketSeries.TickVolume.LastValue is coming as some incremental values.

This should not be the case as this would mean that we always have bid side trades.

And also MarketSeries.TickVolume.LastValue doesn't seem to have the correct values.

Can you please advice if something is wrong with Symbol.Bid and MarketSeries.Close.LastValue and MarketSeries.TickVolume.LastValue or is it I am doing something wrong ?

You help in this will be highly appreciated

.

 

 


@traderan
Replies

Spotware
12 Mar 2015, 17:47

I am printing Symbol.Ask, Symbol.Bid and MarketSeries.Close.LastValue on every tick and noticed that MarketSeries.Close.LastValue and Symbol.Bid values are always same and also MarketSeries.TickVolume.LastValue is coming as some incremental values.

This should not be the case as this would mean that we always have bid side trades.

MarketSeries.Close is built based on bid prices only.

And also MarketSeries.TickVolume.LastValue doesn't seem to have the correct values.

MarketSeries.TickVolume shows number of bid changes for historical trendbars.

Does it help?


@Spotware

Gman89
27 May 2015, 20:24

RE:

Spotware said:

I am printing Symbol.Ask, Symbol.Bid and MarketSeries.Close.LastValue on every tick and noticed that MarketSeries.Close.LastValue and Symbol.Bid values are always same and also MarketSeries.TickVolume.LastValue is coming as some incremental values.

This should not be the case as this would mean that we always have bid side trades.

MarketSeries.Close is built based on bid prices only.

And also MarketSeries.TickVolume.LastValue doesn't seem to have the correct values.

MarketSeries.TickVolume shows number of bid changes for historical trendbars.

Does it help?

If you wanted to use MarketSeries to utilize mid price, what would be the best workaround? I ask because the value for open, high and low based on mid price movement are important in my algo's. This also means initializing my historical window based on mid for my indicators on start.

 

See here:

 

/forum/calgo-support/5340


@Gman89

botmaster
27 May 2015, 23:19

RE: RE:

Gman89 said:

Spotware said:

I am printing Symbol.Ask, Symbol.Bid and MarketSeries.Close.LastValue on every tick and noticed that MarketSeries.Close.LastValue and Symbol.Bid values are always same and also MarketSeries.TickVolume.LastValue is coming as some incremental values.

This should not be the case as this would mean that we always have bid side trades.

MarketSeries.Close is built based on bid prices only.

And also MarketSeries.TickVolume.LastValue doesn't seem to have the correct values.

MarketSeries.TickVolume shows number of bid changes for historical trendbars.

Does it help?

If you wanted to use MarketSeries to utilize mid price, what would be the best workaround? I ask because the value for open, high and low based on mid price movement are important in my algo's. This also means initializing my historical window based on mid for my indicators on start.

 

See here:

 

/forum/calgo-support/5340

It would be nice of a MarketSeries data contained all 8 values like other platforms do.     AskClose, BidClose, AskHigh, BidHigh,  etc...    


@botmaster

maxwell
28 May 2015, 01:35

What gives now  MarketSeries.TickVolume.LastValue

Because you said something about the change in bids? Is ist now the last bid volume or the change in volume to the previous one?


@maxwell

Gman89
28 May 2015, 16:16

This is quite a big deal for a lot of strategies. Does anyone know of a good work around at least? Both for historical OHLC and present time. It's not enough to just add spread/2 to the values as highs and lows will be at different times with different bids and asks compared to when you ask the value.


@Gman89

botmaster
29 May 2015, 00:08

RE:

Gman89 said:

This is quite a big deal for a lot of strategies. Does anyone know of a good work around at least? Both for historical OHLC and present time. It's not enough to just add spread/2 to the values as highs and lows will be at different times with different bids and asks compared to when you ask the value.

I agree, in fact I'm currently porting my system from another platform to give cAlgo a try.    The custom back-testing engine I wrote uses the bid and ask to determine P/L.   Now, that I'm moving things over to a cBot,  I'm rather concerned that back-testing will not be nearly as accurate with bid only values.     


@botmaster

Gman89
29 May 2015, 12:16

RE: RE:

botmaster said:

Gman89 said:

This is quite a big deal for a lot of strategies. Does anyone know of a good work around at least? Both for historical OHLC and present time. It's not enough to just add spread/2 to the values as highs and lows will be at different times with different bids and asks compared to when you ask the value.

I agree, in fact I'm currently porting my system from another platform to give cAlgo a try.    The custom back-testing engine I wrote uses the bid and ask to determine P/L.   Now, that I'm moving things over to a cBot,  I'm rather concerned that back-testing will not be nearly as accurate with bid only values.     

 

For me the issue is that as well as in real time. I don't mind writing my own custom backtester using mid based historical data that I obtain separately, but for real time execution I need to know that the OHLC are based on mid values as well to ensure that my back-testing actually reflects what is being traded. 

I would really like to get a response from Spotware about this. I can deal with a work around for now if anyone can think of a way without writing some elaborate code that calculates the bars myself - but this defeats the point of using cAlgo. Is it possible to use the Indicator or Timeseries classes to do this?


@Gman89

botmaster
30 May 2015, 06:03

Here is what I did to solve the problem.   

 

private bool okToStart = true;
protected override void OnTimer()
{

           // Do Trading here.    Your values will be different. 

}
protected override void OnBar()
 {
            if (okToStart)
            {
                Timer.Start(1800);  // every 30 mins
                okToStart = false;
            }

}

 


@botmaster

Gman89
01 Jun 2015, 14:58

Can you explain the logic? Since I need the mid highs and lows I can't see how this is possible without processing data via the OnTick() method as the instantaneous spread at the time of the mid high/low would have to be known.

At the moment I think the only solution is to write something elaborate to process the tick data to calculate my own bars, then accumulate some history first before actually entering the main code - very annoying.


@Gman89