How CTL Runs


There are differences between how Strategies and Indicators operate.
Indicators:
For each tick (every price change) on the chart, your CTL program will run.
On each run all variables will be reset and recalculated.
Any input variables will be set to last settings in each individual chart.
However if the chart, or Dealbook, is closed before "saving the current layout" the next time Dealbook is started the input variables will be as of the last saved settings.
There is no current 'native' way to save any calculated values for later use.
Depending on what kind of calculations are done to make your new line, since at each tick all "Input" type variables are set back to the chart setting, and all other variables are reset, some kind of loop in your program is needed to recalculate the line on each tick. This can cause some amount of overhead when several charts, perhaps each with several CTL programs running need to recalculate everything every tick.
Strategies:
When a Strategy is opened (attached to a chart) it will first run through each period (candle, bar, point) of the chart, running the CTL program anew at each. Depending on your CTL code, this can cause Dealbook to ‘lockup’ while it traverses the whole chart’s data. Once started the Strategy CTL runs only at the Open of a new period.
As with indicators, strategies will reset variables at each run.

Functions:
Functions are (generally) short reusable routines that can save time and make code more readable. Functions can be called from indicators and strategies. Functions can only return 1 value or 1 series.



Site Content
Home
What is CTL?
>>How CTL runs
Attributes of Strategies, Indicators and Functions

Extended CTL Features