insidebid, insideask too slow for spread calculation.

Questions about MultiCharts and user contributed studies.
bowlesj3
Posts: 1976
Joined: 21 Jul 2007
Has thanked: 155 times
Been thanked: 395 times

insidebid, insideask too slow for spread calculation.

Postby bowlesj3 » 15 Dec 2008

I am using Interactive Brokers and I just tried insidebid and insideask using MC 2.1.999.999. I didn't think it worked with this release but it actually does. However it appears to be a bit slow to pick up changes while at the same time the last price is very fast and basically dead on with TWS.

Has anyone tried this and noticed this including with the newer releases.

John.
Last edited by bowlesj3 on 21 Dec 2008, edited 1 time in total.

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Postby Marina Pashkova » 18 Dec 2008

Hi John,

Most probably you have the indicator applied to a trade series. Every new indicator calculation is run once the symbol is updated, on trades it normally happens more rarely than on bids or asks.

Regards.

bowlesj3
Posts: 1976
Joined: 21 Jul 2007
Has thanked: 155 times
Been thanked: 395 times

Postby bowlesj3 » 18 Dec 2008

Removed.
Last edited by bowlesj3 on 20 Dec 2008, edited 1 time in total.

bowlesj3
Posts: 1976
Joined: 21 Jul 2007
Has thanked: 155 times
Been thanked: 395 times

Actually no.

Postby bowlesj3 » 20 Dec 2008

Removed
Last edited by bowlesj3 on 20 Dec 2008, edited 1 time in total.

bowlesj3
Posts: 1976
Joined: 21 Jul 2007
Has thanked: 155 times
Been thanked: 395 times

Postby bowlesj3 » 20 Dec 2008

Removed
Last edited by bowlesj3 on 20 Dec 2008, edited 1 time in total.

bowlesj3
Posts: 1976
Joined: 21 Jul 2007
Has thanked: 155 times
Been thanked: 395 times

Postby bowlesj3 » 20 Dec 2008

I think I understand your explaination now Marina. Below is my understanding (more in layman's terms) and with application to obtaining the spread calculation.

The study is executed on every tick (trade). However even if MC is processing all studies fairly fast, the bid and asks are changing totally independent of when the trades come in. So the MC study call to get the bid/ask value from TWS is being executed out of sync with when the bid and asks are actually changing in TWS. In other words it is a study execution timing issue.

I now think I understand what Marina meant by "trade Series". She meant (format, symbol, settings, field) set to "trade". Along this line, a "Bid Series" or "Ask Series" would be when (format, symbol, settings, field) is set to "bid" or "Ask". It would be interesting to change the (format, symbol, settings, field) to "bid", on the chart that contains the study which issues the insidebid call and find out if the problem is corrected for the bid. If this worked, then getting very accurate spead info would require two data series (one set to plot bid and the other to plot ask). You would probably need a study for the bid which has its property "Base Study On" set to the bid plot and another study on the same chart for the ask which has its property "Base Study On" set to the ask plot. If both were set to update on every tick then the studies would execute when the bid and ask came in respectively. The values would be sent out to global variables first (the bid study sends out the bid GV and the ask study sends out the ask GV). Both studies, after they send out their bid/ask, would get the other GV required to do the spread calculation.

Maybe I will code this up Sunday, test it Monday and post the results.

Thanks Marina,
John.

bowlesj3
Posts: 1976
Joined: 21 Jul 2007
Has thanked: 155 times
Been thanked: 395 times

Postby bowlesj3 » 30 May 2009

It is Saturday so I can't do this test. I kind of forgot about it actually since I have been unusually busy.

Regarding my conclusions in the above post, to clarify the question, if I do this
1/ I change ESM9 to bid-series via: format, symbol, settings, field, "bid".
2/ set the study to be based upon this symbol running on the Bid-Series,
3/ I set the study to execute on every tick.
then does the study execute on every change in inside bid?

I would assume that if this is true then the command Insidebid would always have the current accurate bid but if it takes a long time for the bid to change then it could be that this study does not run for a long time relative to a study which is based upon a data series based on trade-series (or ticks as we like to call it).

Also (to take an extreme example) if this is true and the bid changes 5 times in one hour but only one trade comes through that hour then a study based upon a symbol set to trade-series would not be able to pick up all those changes in the bid. (I think this is what happened that caused me to create this thread in the first place).

I am not sure why one would want this but if everything I am assuming is correct then maybe some day someone will request these 4 methods of executing a study (also with the ability to set all 4 of them as true but do not allow an overlap).
1/ execute on every tick (every trade)
2/ execute on every change in bid.
3/ execute on every change in ask.
4/ execute on every regular interval of X seconds (example .5 seconds).
5/ execute on FKey? pressed.

I am thinking that maybe a trader would want a study to run every X seconds as a way to be notified if ticks stop (maybe a special study just for this). In another situation maybe a trader would want a study to run if there is a trade or any change in bid or ask. Regarding my concern about overlap, if a trade comes through which causes the bid to change I think the system would somehow need to know not to execute the study twice. Such a feature would obviously need to be well thought out and tested, as well as fully understood by the trader (as always).

Lastly if such a feature was put in the study would need reserve words to know what caused the study to execute since the trader may want to be selective about the code they want to run within the study. Thus the trader could use code like this;

If TradeOccurred = true then

if BidChangeOccurred = true then

if AskChangeOccurred = true then

if TimerExecution = true then

if FKey? = true then

if TradeOccurred = true and
(BidChangeOccurred = true or AskChangeOccurred= true) then

In the last statement the EL engine would eliminate the overlap but the trader could detect it and act accordingly if they want.


Return to “MultiCharts”