ACSIL: working with time and sales data - Sierra Chart Programming | futures io social day trading
futures io futures trading


ACSIL: working with time and sales data
Updated: Views / Replies:8,223 / 44
Created: by yonatan Attachments:17

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 17  
 
Thread Tools Search this Thread
 

ACSIL: working with time and sales data

  #11 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received

Well... it seems to work!

As a reminder, GetTimeAndSales() only gives access to the most recent T&S (typically: last 2,000 trades), so is not very suitable on historical data.

It exists another way to access T&S: use a 1-tick chart in parallel, since it "embeds" all the T&S information (by the way, this is also suggested by SC T&S documentation).

On the below chart of 2-min TF...

The first sub-panel is built-in SC information: volume, ask volume, bid volume, upticks volume, downticks volume.

The second sub-panel gives the same volume information, but recomputed by a custom study on the basis of the 1-tick chart.
This study identifies the 1-tick ticks which correspond to the 2-min bar.
Then, it looks at these ticks one by one, see if the trade was at the ask or at the bid (for ask volume and bid volume), see if it was an uptick or a downtick (for upticks and downticks volume), etc.

The figures are the same, so the logic of the study seems OK.
The code could give a template to access T&S data within each bar of a chart.

For instance, and referring to @yonatan's previous message, nothing prevents in theory from emulating SC's pullback column.

Except if some one has an urgent need, I do not intend to post the code right now:
- it works with historical data, but I would like to check it in real-time
- it only works for time charts, and I would like to adapt it to other charts (range charts, reversal charts, volume charts, etc.)

Nicolas

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


Last edited by Nicolas11; August 11th, 2012 at 08:50 AM.
Reply With Quote
The following 2 users say Thank You to Nicolas11 for this post:
 
  #12 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received

One futures.io (formerly BMT) member asked me the code via PM.
So here it is... scsf_Volume_Emulated_for_TimeCharts (v1)

Reminders:
- it only works for time charts (no range-chart, volume-chart, etc.)
- it may not work in real-time
Of course, use at your own risks.

Do not forget to correct the #include line at the beginning of the code.

Use:
  • Open a 1-tick chart of the instrument
  • Open a 2-min chart of the instrument (or other timeframe, but still time-based)
  • On the 2-min chart, add "Volume (emulated) for time charts only" study. Check that the input field "1-tick chart" refers to the 1-tick chart. Otherwise, change it.
  • The 5 emulated volume information shall appear in the sub-panel (total volume, bid volume, ask volume, upticks volume, downticks volume) of the 2-min chart. You can compare them with SC built-in data.

Nicolas

Attached Files
Register to download File Type: txt scsf_Volume_Emulated_for_TimeCharts - v1.txt (6.9 KB, 45 views)
Reply With Quote
The following 2 users say Thank You to Nicolas11 for this post:
 
  #13 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received


I am facing a serious difficulty for non-time-based charts.

I do not succeed in making a tick-by-tick correspondence between, let's say, a 6-range chart, and a 1-tick chart.

Even between a 100-tick chart and a 1-tick chart.
I have them side by side. How could I know which ticks of the 1-tick chart belong to a given 100-tick candle?

I have tried with ACSIL, but all functions I find in this area (as sc.GetNearestMatchForDateTimeIndex) are time-based.
My question on SC board: Access to Time & Sales via a secondary 1-tick chart - Sierra Chart

I have tried to overlay, but I have observed that the overlay is not precise to the tick.
When overlaying, mapping is apparently not done tick by tick. It is rather done with timestamp, which are less precise than ticks (there could be several ticks in the same second).
My question on SC board: problem with overlay and tick charts - Sierra Chart (with an illustration)
A previous answer from SC support that I have just found on SC board: tick count not accurate - Sierra Chart

I am blocked now. Any idea welcome!

Nicolas


Last edited by Nicolas11; August 11th, 2012 at 01:13 PM.
Reply With Quote
 
  #14 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received

I found a workaround.
And I would not say it was easy.
It now seems to work with nearly all kinds of charts.
More on this later. I need to clear things up...

Reply With Quote
 
  #15 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received

Goal: access to all the individual trades (ticks) within a bar of the chart.

Some solutions have previously been excluded:
A solution has already been proposed for time charts (for instance: 2-min) only. It cannot be used with other kind of charts, since it uses time-based functions as sc.GetNearestMatchForDateTimeIndex.

This message proposes a new solution: scsf_Volume_Emulated (v1)

It works with many kind of charts:
  • time chart (for instance: 2-min chart)
  • range chart (for instance: 6-range chart)
  • reversal charts (for instance: 5-reversal chart)
  • tick charts (for instance: 2,000-tick chart)
It does not work with volume charts, since they apparently do not respect the integrity of each tick. For instance, the volume of each bar of a 10,000-volume chart is exactly 10,000. It shows that tick at the border between 2 bars are split between the 2 bars.

How does it work?
Let's suppose that the main chart is a 2-min chart.
The study maintains an index on the 1-tick chart and follows the progress of the 2-min chart. It moves the index on the 1-tick chart in order to catch-up the volume on the 2-min chart.
More precisely, each time the 2-min chart is updated...
(1) If we are still on the same 2-min bar as in the previous update...
  • Is it the same volume in the bar as in the previous update? --> nothing to do
  • Has the volume in the bar increased? --> the study moves the index on the 1-tick chart until the volumes on the 2 charts are the same
(2) If it is a new 2-min bar...
  • First, the study moves the index on the 1-tick chart until the volume on the previous and completed 2-min bar is reached
  • Then, the study moves the index on the 1-tick chart until the current volume on the current 2-min bar is reached

How could it be used?
By the above process, the study "sees" which ticks of the 1-tick chart are contained within each bar of the 2-min chart.
The programmer could insert instructions to do something specific.
For instance... see next paragraph.

What does the code do?
The attached code illustrates a possible use of the above by emulating SC's built-in volume, ask volume, bid volume, upticks volume and downticks volume.
We have already seen that the study identifies the individual ticks which belong to the 2-min bar.
The study looks at these ticks one by one as soon as they are identified, see if the trade was at the ask or at the bid (for ask volume and bid volume), see if it was an uptick or a downtick (for upticks and downticks volume), etc.

Disclaimers:
- not tested in real time (just on historical data)
- a bit experimental
- use at your own risks

Do not forget to correct the #include line at the beginning of the code.

Prerequisites:
In "Data/Trade Service Settings", I have :
- Download Historical Intraday Data As: Ticks
- Intraday Data Storage Time Unit: 1 Tick

Use:
  • Open a 1-tick chart of the instrument
  • Open a 2-min chart of the instrument (or other kind of chart - see above)
  • The 2 charts (1-tick and 2-min) shall start at the exact same date
  • On the 2-min chart, add "Volume (emulated)" study. Check that the input field "1-tick chart" refers to the 1-tick chart. Otherwise, change it.
  • The 5 emulated volume information shall appear in the sub-panel (total volume, bid volume, ask volume, upticks volume, downticks volume) of the 2-min chart. You can compare them with SC built-in data.

Below please find some screenshots on 4 different kinds of charts (and 4 different instruments).

I am aware that the above is a rather complicated, that the code (even if commented) is too "heavy" and that probably nobody will need to use it. But it was an interesting coding experience for me. So, no regret. And it will be useful for my own research.

Nicolas

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Attached Files
Register to download File Type: txt scsf_Volume_Emulated - v1.txt (13.8 KB, 41 views)

Last edited by Nicolas11; August 11th, 2012 at 05:46 PM.
Reply With Quote
The following 3 users say Thank You to Nicolas11 for this post:
 
  #16 (permalink)
Elite Member
Haifa Israel
 
Futures Experience: Beginner
Platform: sierra chart
Broker/Data: Optimus Trading Group/Rithmic
Favorite Futures: es
 
Posts: 90 since Apr 2012
Thanks: 49 given, 65 received

Great work @Nicolas11. Thanks for sharing the process and the codes. most valuable.

Reply With Quote
The following user says Thank You to yonatan for this post:
 
  #17 (permalink)
Elite Member
Portland, OR
 
Futures Experience: Intermediate
Platform: Sierra Chart
Favorite Futures: ES
 
Posts: 269 since Jan 2011
Thanks: 326 given, 179 received

Nicolas - There is an option under Chart settings -> advanced settings - "split data records".

I think - if you uncheck that - this should work even for volume charts as well.

Thanks.

Reply With Quote
The following user says Thank You to ejtrader for this post:
 
  #18 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received

Thanks @ejtrader !
I didn't know that.

For reference, extract of the documentation: (red color added)

Quoting 
Split Data Records (applies to Tick, Volume and Range charts)

When this option is enabled, data records from the chart data file are split, if necessary, to create 100% constant Tick, Volume, Range, Reversal, or Renko charts. If you want your Tick, Volume, Range, Reversal, or Renkochart bars to be based precisely on your settings, then be sure this option is enabled.

In the case of Tick and Volume charts, if a data record is other than 1 tick, then the OHLC of the data record is not split. Only the Volume and Number of Trades fields are split and distributed among the bars to match your setting. What this means is that if the high of the data record is 105 and the low is 100, and it is split 5 times, then you would see 5 bars in the chart with that range even if your setting is 1 tick. Therefore, with these types of charts, you always want to ensure your data records are of the shortest timeframe possible. This is discussed in more detail in help topic 47. In the case of range bar charts, the OHLC, Volume and Number of Trades of the data records are split to create bars that match your range bar setting.

If the data records in the chart data file are 1 tick, this is when the Intraday Data Storage Time Unit setting is set to 1 Tick, then splitting does not occur unless you are using Volume charts. The reason for this is because a single 1 tick data record can have a volume more than 1, so splitting may be necessary to distribute the volume across more than one bar.

Source: Sierra Chart - Chart Settings

Nicolas

Reply With Quote
 
  #19 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received

Here-above, I said that overlay could not be used to know precisely which tick are within a 2-min bar, since the overlay is not precise to the tick.

In a discussion with Sierra Chart support on their board, they have confirmed that overlay is based on timestamp. And several ticks may have the same timestamp (= same second). It explains the behaviour. So a 10-tick chart/study will overlay on average with a 1-tick chart/study, but not to the tick.

Following this discussion, they have updated their documentation in order to explain the above, and give the detailed mechanism behind the the overlay: (red color added)

Quoting 
There are 2 charts involved with this study. They are called the Source chart and the Destination chart. The study is applied to the Destination chart and obtains data from the specified Source chart using the Study to Overlay Input. The study uses the timestamps of the chart bars to determine what specific element/column of the study or price data from the Source chart to overlay on the corresponding element/column on the Destination chart. Each Destination chart column covers a specific time range. The latest element within that time range from the Source chart is overlaid on the Destination at the chart column with that same time range. For example, if on the destination chart there is a chart bar with the time range of 10:00:00 through 10:00:59, then the study or price data from the Source chart with a time of 10:00:59, or nearest to it, but not greater, is then used on the Destination chart.

In the case where there are repeating timestamps in the Source Chart, the study or price data from the rightmost chart column with the same timestamp will be overlaid in the Destination chart. In the case where the Destination chart has repeating timestamps, the overlaid study or price data from the corresponding Source chart column will repeat at each Destination chart column that has the same timestamp.

Source: Sierra Chart - Technical Studies Reference

Nicolas

Reply With Quote
 
  #20 (permalink)
Elite Member
San Jose, CA
 
Futures Experience: Intermediate
Platform: Sierra Chart
Broker/Data: IB/IQFeed
Favorite Futures: Futures
 
Posts: 110 since Jan 2011
Thanks: 54 given, 89 received


Not really a solution for you, but just a comment that you can go quite a bit higher than 2000 records for time and sales. I don't know what the upper limit is but I have been running with 50000 with no problem.

Reply With Quote

Reply



futures io > > > > > ACSIL: working with time and sales data

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Time and Sales - Level I - Level II - tick data trendisyourfriend Traders Hideout 4 August 28th, 2014 01:14 AM
ACSIL: How do I get the time value of a Vertical line that I have drawn on the chart yonatan Sierra Chart Programming 7 June 25th, 2012 08:20 AM
Austerity Isn't Working; It's Time for a Plan B Quick Summary News and Current Events 0 June 6th, 2011 07:40 AM
Time and Sales help traderTX The Elite Circle 3 May 3rd, 2011 11:14 AM
Is it possible to get "historical" Time and Sales data? adaseb Reviews of Brokers and Data Feeds 2 September 8th, 2010 12:18 PM


All times are GMT -4. The time now is 01:31 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-11 in 0.19 seconds with 20 queries on phoenix via your IP 54.145.16.43