Seeking the size of current bid and ask ...

Questions about MultiCharts and user contributed studies.
User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Seeking the size of current bid and ask ...

Postby furytrader » 18 Oct 2010

Is there any way in PowerLanguage and MultiCharts to find out what the current size of the best bid and offer in a market is?

User avatar
RobotMan
Posts: 375
Joined: 12 Jul 2006
Location: Los Altos, California, USA
Has thanked: 31 times
Been thanked: 13 times
Contact:

Re: Seeking the size of current bid and ask ...

Postby RobotMan » 18 Oct 2010

Is there any way in PowerLanguage and MultiCharts to find out what the current size of the best bid and offer in a market is?
LOL :D

No. Just the last trade size. ...Sometimes.

see: http://www.multicharts.com/discussion/v ... f=1&t=6307

I am assuming this is a dead subject and cannot be solved in Powerlanguage. Although the code works, it somehow does not "see" every tick. Who knows why. I have given up trying to get answers from Andrew/TSS.

I suggest just using "UpTicks" and "DownTicks" and avoid "IntraBarPersist".

Let the flames begin. ..........I'm going back into my cave.

Nick
Posts: 496
Joined: 04 Aug 2006
Has thanked: 4 times
Been thanked: 24 times

Re: Seeking the size of current bid and ask ...

Postby Nick » 21 Oct 2010

No flames from me, in fact quite the reverse. Personally I think it is critical to provide proper sequencing, time stamping, and full and complete data for multiple real time and historical data streams. (bid and ask data are just 'other data streams'). Not doing so rules MC out for a whole bunch of applications that need precision, (the correct and full sequence of market events).

Indicators based on MD (volume transacted at bid vs. volume transacted at ask) not only give a great edge but they are are already hugely popular and gaining popularity all the time. TSSupport must be aware of the current limitations, I know a couple of individuals and traders who represent groups who have contacted them to try and persuade them to sort it out. It's an area where MC can easily get left behind as their competitors either offer it already or realise the importance of offering it in the near future.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: Seeking the size of current bid and ask ...

Postby janus » 24 Oct 2010

It will never be possible to retrieve continuously the current bid-ask sizes since MC has to wait for a trade before it can run the study. Until this is changed, there's no point even attempting to request such a feature. It will require some changes to how MC operates. In very active markets such a limitation is not too critical, but in others it can be. Although I feel they should do this work as a matter of high priority since it's highly likely more and more competing packages will be doing it, I doubt MC will ever listen and take notice until perhaps some time in the distant future. So, if you really are desperate to have a streaming view of current bid-ask sizes then look elsewhere.

NiC72
Posts: 111
Joined: 02 Nov 2009
Location: Sweden
Has thanked: 39 times
Been thanked: 14 times

Re: Seeking the size of current bid and ask ...

Postby NiC72 » 24 Oct 2010

It is possible but only manually (if you have IB, is not aware of other brokers opportunities).
I get the current size of the best bid and offer from IB Booktrader.

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Seeking the size of current bid and ask ...

Postby furytrader » 24 Oct 2010

Does that come through MultiCharts? For example, eSignal tracks time & sales in real time so you can definitely get the best bid and offer from their data stream.

I'm thinking, within the context of MultiCharts, for the reasons cited above, you'd either (a) have to create a new data stream that tricks MultiCharts into thinking that a change in the bid offer is a trade (and so allows you to run code to analyze it) and then find a way in the data stream to distinguish between changes in the bid/offer with actual trades or (b) depending on what you want to do with the size of the bid/offer, create a .dll that retrieves this information from your data stream and then makes it available to MultiCharts when an actual trade occurs.

For what I want to do, option (b) may work best because what I'm looking for is information on the size of the bid/offer when an actual trade occurs.

If I come up with anything in this regard, I'll be sure to post it here.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: Seeking the size of current bid and ask ...

Postby janus » 24 Oct 2010

Real-time bids can be tracked by MC if you select bid in the quote field for the chart. Likewise for ask prices. However, you can't do both at the same time on the same chart, and also plot trade price as well with them. That's the limitation of MC I'm talking about. So, option a) and b) won't be of any use. I was going to write a dll to retrieve bid and ask in real-time for my own charting package, which I developed before I bought MC. I no longer need it since I'm not so interested in true real-time bid-ask prices for automatic trading purposes. However, sometimes I do use IB to watch the bid-ask queue depth to override my automatically generated trades manually. Even then I'm using it less and less as I have found it to be of less value than I once thought. It certainly would help if you wanted to adjust the number of contracts to trade at market. When I trade at market my contract sizes are nearly always well below the current bit or ask sizes so it's not really a concern. If and when my sizes become too large, I will use limit orders instead plus some extra code to cancel them after certain conditions are satisfied (eg, elapsed time is too long or trade price is too far away from my original entry price).

If you are thinking of setting up three charts, one each for bid, ask and trade prices, and then develop a study for each to manage the orders; forget it. It's far too complex. If one of the studies has already submitted an order, the other two when updated can't cancel it immediately if that's the appropriate course of action, at least not without a dll to override the original order. Even then there's no guarantee this will work since the study that submitted the original order may re-submit if it runs in parallel or too quickly after it one that cancelled the order, even if the appropriate global variable is updated. You could include some sophisticated handshaking code to keep all three studies synchronized. Then you run the risk of hanging one of the studies. It depends on how MC runs in a multi-threaded and/or multi-core environment. There are other issues too. It's just far too complex a problem to try and do it this way.

The only way I thought of doing it is to write my own dll to retrieve the bid, ask and trade prices. This dll would also contain all my trading rules. Then when an order needs to be submitted or cancelled, I would output a code to an ASCII file, plus perhaps the last trade price (eg, in decimal form code.trade*1000). MC would be set up to use this file as an ASCII mapping instrument. Then a study would be associated with it to manage the orders depending on the code in the file. However, if I were to go this far I wouldn't really need MC as I might as well submit the orders through my application. MC is then used just only for plotting purposes.

So, the only real solution I know is to trade with another package that provides the ability to access all the real-time bid-ask sizes, if they are essential for your trading purposes. If someone can do it via MC, I would be very interested to know about it.

Nick
Posts: 496
Joined: 04 Aug 2006
Has thanked: 4 times
Been thanked: 24 times

Re: Seeking the size of current bid and ask ...

Postby Nick » 25 Oct 2010

It will never be possible to retrieve continuously the current bid-ask sizes since MC has to wait for a trade before it can run the study. Until this is changed, there's no point even attempting to request such a feature. It will require some changes to how MC operates. In very active markets such a limitation is not too critical, but in others it can be. Although I feel they should do this work as a matter of high priority since it's highly likely more and more competing packages will be doing it, I doubt MC will ever listen and take notice until perhaps some time in the distant future. So, if you really are desperate to have a streaming view of current bid-ask sizes then look elsewhere.
Actually you can. Run three data streams data1 data2 data3 and assign them to bid ask and last. The trouble is that you can not easily tell which one generated the 'tick' (and there are some architectural issues that seem to affect accuracy). Edit: You say that didn't work for you? You can set things up like this there are just 'issues' with accuracy.

I have indeed looked elsewhere though would much rather use MC for this sort of work. I like MC and I have invested an awful lot of time into it. Of course those that do not have that investment would certainly not consider MC for this sort of work. Incidentally it is not just bid ask stuff that this affects.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: Seeking the size of current bid and ask ...

Postby janus » 25 Oct 2010

Yes, that's true - by plotting all three on the same subchart, one could pick up the changes in any of them. However, will it also pick up the changes in the bid or ask sizes even if the bid and ask prices don't change? If it does then those who want to use streaming changes to bid-ask sizes in their studies can do so.

Nick
Posts: 496
Joined: 04 Aug 2006
Has thanked: 4 times
Been thanked: 24 times

Re: Seeking the size of current bid and ask ...

Postby Nick » 26 Oct 2010

I tested with Zenfire and it appeared to. You do get 'ticks' that update two of the data streams on the same tick, you would expect this though. I didn't explicitly detect for ticks where everything was the same though. The problem I had was there where too may 'wrinkles'.

I wrote some test code to check for unusual conditions (like crossed markets) it also tested for race conditions by storing bid ask and last.......doing a couple of nested loops to soak up processor time.....reading bid ask and last again. It was possible to get them to change from when the indicator started to run to the value at the end. The long and the short of it is that study processing is not completely synchronous with tick processing under all conditions. Put another way the value of 'last' can change between the start of a user study and the end. It occurs to me I should run the test on a single core....it may be an issue there. I guess this is at the heart of the 'missing tick in studies' issue that other have reported.

Actually now I have remembered step by step what I did I can say the problem is not only with multiple data streams, it would appear there is a core architectural issue with how ticks are processed and studies are run.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: Seeking the size of current bid and ask ...

Postby janus » 26 Oct 2010

I discovered similar results some time ago when I also wrote some test scripts. Yesterday I watched IB's market depth while I was printing bid-ask-trade prices in a study. Sometimes I would see the top level in the market depth flip very quickly to a different price then back again. MC sometimes misses it. I agree it can happen in a normal study where just trade price is used. The conclusion is, as I always suspected, MC is not suited for high frequency trading. There are other tools available for that purpose. At the moment I don't have a requirement for such a tool and MC suits me fine.


Return to “MultiCharts”