Bars from tick data
Author: Rebelion
Creation Date: 7/2/2013 3:51 AM
profile picture

Rebelion

#1
Hello, guys.

It's a stupid question I have, but how could I create Bars object for ticks data I have? And another one - If I have my own candles created from ticks and loaded through an Excel or ASCII provider, so how can I ask each bar if they are not connected to the time (have all datetime values identically)?

So, Eugene, pls, could you tell me how to make a ticket for creating IQFeed data provider with ticks data collecting? One day you said that's possible, but you need a ticker from a client and you are not sure about the time when this augmended data provider will be created...
profile picture

Eugene

#2
QUOTE:
It's a stupid question I have, but how could I create Bars object for ticks data I have?

You already have the Bars object for any data you have because a tick is a bar where O=H=L=C. You may try the unsupported BarScaleConverter class to convert to a higher scale; not sure if it works with tick data or not:

Code to do SetScaleQuarterly() or SetScaleYearly()

QUOTE:
So, Eugene, pls, could you tell me how to make a ticket for creating IQFeed data provider with ticks data collecting?

Click "Support", then "Ticket Center".
profile picture

Rebelion

#3
Thnxs, Eugene! I'll try this both today's evening. :-)
profile picture

Rebelion

#4
Emmm... Another question - how it possible to change Bars object I get in the strategy? I tried through reflection - no result (tried to change hidden fields of Dataseries).
I have a task - I have ticks data I need to recombine to my own candles, after that I pass my strategy through these new candles and wanna get signals. But, I get it on ticks data, not on my own candles... What should I do for correct task realization? What's way to change Bars? :-(
profile picture

Eugene

#5
Already answered (see reply #2 above).
profile picture

Rebelion

#6
Eugene, It doesn't work...


CODE:
Please log in to see this code.



I have this code do nothing on the primary Price Pane...
profile picture

Eugene

#7
Have you reviewed the code example from my link above?

BarScaleConverter is not a void, it returns a Bars object. You already see what you're doing wrong?

CODE:
Please log in to see this code.


Hint: you're not using the converted Bars object anyhow.
profile picture

Rebelion

#8
Eugene, there are some problems I have. Without changing Bars object (which contains ticks at the start) I have signals, generated by BuyAtMarket, SellAtMarket, ShortAtMarket and CoverAtMarket, connected with Bars object, not on my own bars in reverserBars.
And there is no way to change this object (Bars) through BarScaleConverter - I can't write
CODE:
Please log in to see this code.

At the second, I want my candles to rewrite ticks data I have at first...

The dummy code below I didn't include - it better to read the code with bars generation without this block.

CODE:
Please log in to see this code.


Pls, is it any way to change Bars object? Or other way to realize what I need? :-(
profile picture

Eugene

#9
Yes, you can't "replace" Bars with a new Bars object. Here's what could be done instead:

FAQ: Is there ChangeBar method in WL6?

In other words, loop through the Bars collection and modify the basic DataSeries on a bar by bar basis w/o changing the Date (that won't work).
profile picture

Rebelion

#10
Ehhh... But no way to cut Bars object? For example, Bars has approx 331000 bars, but reversedBars has approx 600 bars. I need to cut off approx 330000 bars in Bars, but don't know, how to do this... Is it possible?
profile picture

Eugene

#11
It's not possible using the supported methods.

What you can do is serialize the reversedBars object to a .WL file and load that file using this detailed procedure:

How to create a DataSet from SaveToFile() *.WL data
profile picture

Rebelion

#12
Mmm... Not so easy...
Eugene, is is any hope to have internal structure of Bars changed in the future? I have my hands bounded working with Bars object - no way to change and etc
profile picture

Eugene

#13
No.
profile picture

Rebelion

#14
Hmmm... Think, I'll solve this problem through separate optimization and visualization.
Other problem I have now with ticks data and handmade candles from ticks. If I use raw mode data profit on the 1 share, I have all 9 trades correct. But If I choose "Portfolio simulation", I have some trades hidden with the reason "Trades not included due to insufficient simulated capital". I have 500000$ capital, 1 share costs < 150000$, I have 71 bars in my simulation, all bars <= 250$ in height. What's the reason? If I try to use "Percent of Equity", I have only 1-2 trades with the same reason. What do I wrong? No problem with Raw Data, but problems with portfolio simulation. Is this connected with ticks data? I have my bars data all identically...
profile picture

Eugene

#15
It doesn't have to do with your bar scale, otherwise you'd notice similar situation in Raw Profit mode. What it has to do with is the concept of basis price and possible lack of capital. Please see the User Guide > Strategy Window > Backtesting Strategies > 100% of Equity Sizing.

Even the same Fixed Share sizing (let alone 100% equity) may and will be different in Portfolio Simulation mode where real-world position sizing rules come into play - compared to RP mode which doesn't have the risk of running out of cash (considering that the price e.g. $150,000 is way less than the equity value i.e. $500,000).

If you have further questions, feel free to ask in a different thread: as I said it's not a bar scale thing.
profile picture

Eugene

#16
QUOTE:
So, Eugene, pls, could you tell me how to make a ticket for creating IQFeed data provider with ticks data collecting?


Starting from v2016.06 IQFeed provider supports Tick data.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).