NexusFi: Find Your Edge


Home Menu

 





ACSIL: working with time and sales data


Discussion in Sierra Chart

Updated
      Top Posters
    1. looks_one Nicolas11 with 31 posts (22 thanks)
    2. looks_two yonatan with 6 posts (5 thanks)
    3. looks_3 mkruss with 3 posts (0 thanks)
    4. looks_4 ozunainc with 3 posts (0 thanks)
    1. trending_up 20,099 views
    2. thumb_up 28 thanks given
    3. group 12 followers
    1. forum 47 posts
    2. attach_file 17 attachments




 
Search this Thread

ACSIL: working with time and sales data

  #11 (permalink)
 
Nicolas11's Avatar
 Nicolas11 
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
Posts: 1,071 since Aug 2011
Thanks Given: 2,232
Thanks Received: 1,769

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


Visit my NexusFi Trade Journal Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
Better Renko Gaps
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
Increase in trading performance by 75%
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
My NQ Trading Journal
12 thanks
  #12 (permalink)
 
Nicolas11's Avatar
 Nicolas11 
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
Posts: 1,071 since Aug 2011
Thanks Given: 2,232
Thanks Received: 1,769

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
Elite Membership required to download: scsf_Volume_Emulated_for_TimeCharts - v1.txt
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #13 (permalink)
 
Nicolas11's Avatar
 Nicolas11 
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
Posts: 1,071 since Aug 2011
Thanks Given: 2,232
Thanks Received: 1,769


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-[AUTOLINK]tick chart[/AUTOLINK] - 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

Visit my NexusFi Trade Journal Reply With Quote
  #14 (permalink)
 
Nicolas11's Avatar
 Nicolas11 
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
Posts: 1,071 since Aug 2011
Thanks Given: 2,232
Thanks Received: 1,769

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...

Visit my NexusFi Trade Journal Reply With Quote
  #15 (permalink)
 
Nicolas11's Avatar
 Nicolas11 
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
Posts: 1,071 since Aug 2011
Thanks Given: 2,232
Thanks Received: 1,769

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








Attached Files
Elite Membership required to download: scsf_Volume_Emulated - v1.txt
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #16 (permalink)
 yonatan 
Haifa Israel
 
Experience: Beginner
Platform: sierra chart
Broker: Optimus Trading Group/Rithmic
Trading: es
Posts: 91 since Apr 2012
Thanks Given: 50
Thanks Received: 71

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

Started this thread Reply With Quote
Thanked by:
  #17 (permalink)
 ejtrader 
Portland, OR
 
Experience: Intermediate
Platform: Sierra Chart
Trading: ES
Posts: 269 since Jan 2011
Thanks Given: 327
Thanks Received: 180

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
Thanked by:
  #18 (permalink)
 
Nicolas11's Avatar
 Nicolas11 
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
Posts: 1,071 since Aug 2011
Thanks Given: 2,232
Thanks Received: 1,769

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

Visit my NexusFi Trade Journal Reply With Quote
  #19 (permalink)
 
Nicolas11's Avatar
 Nicolas11 
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
Posts: 1,071 since Aug 2011
Thanks Given: 2,232
Thanks Received: 1,769

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

Visit my NexusFi Trade Journal Reply With Quote
  #20 (permalink)
 Jolew 
San Jose, CA
 
Experience: Intermediate
Platform: Sierra Chart
Broker: IB
Trading: Futures
Posts: 113 since Jan 2011
Thanks Given: 54
Thanks Received: 97


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




Last Updated on November 9, 2019


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts