Welcome Guest, you are in: Login
CTS Futures
Home
Pricing
FAQ

T4 Desktop
User Guide
Scripting Guide
Release Notes

Mobile and Web
T4 Mobile
T4 WebTrader

Admins
T4 Admin Guide

Developers
API 4.0 Guide
API 4.0 Reference
FIX API




Search the wiki
»

Safely Handling Events and Accessing Chart Data

RSS
The information in section applies to both ChartDataSeries and any of the various IndicatorSeries mentioned above.

In order for the API to be able to safely update data in real-time and yet still allow access to the same data, a locking strategy is employed to prevent data corruption and various other concurrency errors.

If you mind two rules of thumb, this will never be issue.

  1. If your code is running within, or called from any of the API event handler methods (ChartDataSeries.DataLoadComplete, ChartDataSeries.DataSeriesUpdated, IndicatorSeries.IndicatorSeriesUpdated), then no locking necessary because the API wraps these event calls within a lock already.
  2. If your code is running outside any of the above mentioned event handlers and you to access the chart or indicator data, you must wrap the data access with Lock() and Unlock() methods (either on the ChartDataSeries or the IndicatorSeries).

This locking strategy is similar in anture to the rest of the way the T4 API operates and should not be unfamiliar.

It is worth mentioning that code that executes while the API data structures are locked must run quickly and efficiently. The API must queue real-time during the time the data structures are locked, and queuing for too long could result in delayed updates and in extreme cases, excessive memory use.

Trade how you want, where you want

support@ctsfutures.com (312) 939 0164

141 W. Jackson Blvd., Suite 211A, Chicago, IL 60604

© 2009-2012 Cunningham Trading Systems Inc. All rights reserved.