Signal and Action Reference

Actions

Regardless of the type, actions are added by going to Add signal > add action.

Lets cover some specific types of actions you can use in your design.

Please Control+H if you have questions about this or any action.

Market Actions


These actions send market orders for a given size.   You must supply the size of the order as a simple signal (eg add signal > common > simple > number > entrysize = 100).

You can optionally specify a symbol or destination/exchange.   If you don't supply a symbol or destination, the default is used.

To add symbol or destination signals options, do one of the following :
  1. add a simple signal to hold your symbol or destination (eg add signal > common > simple > text > mysymbol = XYZCONTRACT / mydest = ARCA)
  2. create a CSV text file with a header like: inputsymbol,outputsymbol,destination. 
    1. populate this file with the correct symbols and destinations and save it somewhere locally
    2. Then add a csv signal to this file (add signal > other > csv)
Please Control+H if you have questions about this or any action.

Limit and Stop Actions

Limit and stop actions are exactly the same as market, except you must provide an additional signal for order price.

You can create order price signals as you would with any signal, here are some examples :
  • create price signal manually using simple signals (add > common > simple)
  • use bid or ask sizes, or position sizes.
  • calculate price signals from other signals (add > common > combined).  (eg take half of the bid)
  • using csv signals, dlls, etc
By default and for safety, actions will only fire one order per action even if the action remains active.

To change this, see Multi-fire actions below.

Multi-fire Actions (Granular)

While actions remain active for as long as they are set, by default they will only fire a single order.   

This is to protect you from your accidentally causing order loops.

You can of course control secondary and tertiary entries and exits, simply by adding a dedicated action for each level.

Another way is to allow your existing actions to refire.    

This is done by creating a new action that sets an existing action to false.

eg

entry_action <= send order from some signals
exit_action <= send order from some signals
multifire_action <= is_exit_action and notflat set entry_action = false

This would allow your entry to re-fire given an exit condition.

Multi-fire Actions (Coarse)


You can allow all actions to refire on a position becoming flat or reversing, by adding the design item 'Action Flat Refiring'.

Please Control+H if you have questions about this or any signal.

Action Order Pegging

You can optionally peg an order to a particular signal.   This means that as the signal price or size changes, your design will automatically update whatever remains on your order.

To enable pegging, simply check the 'peg' box on the action.

Please Control+H if you have questions about this or any signal.

Action Cancels

You can cancel limit and stop actions, regardless of whether they are pegged or unpegged (assuming the action's orders have not already filled or canceled).

To cancel an action, simply add the cancel action: add > action > cancel.   Provide the triggers for the cancel, and the name of the action that should be canceled.

To determine whether an action has been filled or canceled, add an Action Status signal associated with the action you want to check.  (see below).

Please Control+H if you have questions about this or any signal.

Action Sets


Action sets allow you to change signal values based on some set of triggers.     

These can be used as an alternative to combined signals or branches, especially when you have many triggers that are required.

Please Control+H if you have questions about this or any signal.

Action Order Status

Action Status signals are used to get information about the progress of an action.

Status signals are linked back to particular actions, and include things like whether the order is filled or canceled, how much has filled, and so on.

To get status of an action, add > account > action status.    Select the action to get status on and click ok.   You will then see several signals added that correspond to fill and cancel status.

Please Control+H if you have questions about this or any signal.

Combined Signals


Combined signals allow you to create new custom signals from existing ones.    

Combined signals are added via the design editor :
  1. add signal > common > combined
  2. choose the type of signal combine (+/-/*/Power/etc from 50 different combine types)
  3. choose the first signal to combine
  4. if the type of combine requires two signals, choose the second signal.  (signals are generally read left to right, so signal1^signal2 would be Power Combine : signal1,signal2).

Example, subtract a 5 minute close from a 3 minute close  :
  1. add signal > common combined :
  2. select subtract
  3. select 5 minute close signal as signal 1
  4. select 3 minute close as signal 2
  5. select modify

Safe signals ensure that if you have an invalid calculation (eg that results in infinity, like dividing by zero), your strategy will continue uninterrupted and that signal will be set to zero (which makes has_data signals return false).

Sticky signals "stick", so that when they are set to true they will not go back to false (unless you set them to false via a signal set action).    

This can be useful for remembering whether a given price level has been crossed or touched during a trading session or round turn.



Previous and Summary Signals

Previous and summary signals allow you to work with signals you've previously received.

Previous Signals

Adding a previous signal will allow you to obtain the value of that signal, some number of signal value previously.

eg creating a previous signal for close_t300_3 would give you the value of 5min close 3 signals ago.     You could use multiple previous signals together to compare say the 5 and the 3 previous signal values of the 5min close.

In this way, Previous signals are somewhat similiar to the concept of 'bars-back'.  However, previous signals are more powerful because you're not limited to bars.

You have control of the timing of when previous values are needed.    By default previous signals are updated on every tick.

You can change this and link the update condition, eg making a previous signal close update only when the close has data, or when the 5min bar is new, or when the high is broken.

Please Control+H if you have questions about this or any signal.

Summary Signals


Summary signals summarize data over some number of previous signals.    

Eg a Signal summary of lasttrade 20 would create a simple moving average of trades.   Many different types of summaries are available.

 Like previous signals you can control the frequency of summary updates.

Even though they are related conceptually, they are independent and thus it's not necessary to create previous signals in order to use summaries.

For safety Signal Summaries will not calculate until they have received your minimum # of updates (eg with lasttrade 20 average, they would show an average only after 20 update conditions have occured).

Please Control+H if you have questions about this or any signal.

Bootstraping Signals

This section covers controlling signal acquisition and startup in Glean.

By default, Glean runs off tick data meaning that it will populate signals according to your calculations.

For the included bar data, this may mean you have to wait some number of bars to see your signals populate.

Bootstrapping w/Historical Bars (recommended)


To avoid waiting for signals to calculate, we recommend most users use a connector or feed that supports historical bars such as IQfeed (7 day trial available)

If you add the AutoBarBackfill signal, Glean will automatically detect historical bar sources if they are available and pre-request enough data to ensure your signals have values when you start the design.

This will occur regardless of whether you are testing historically/live, trading live in ASP, in Gauntlet, etc.

Here is what your signals will look like at startup if a historical bar source is running (notice the bar count starts at the required # of bars, and your signals will start with data right away).

autobar backfill example ss


You can also bootstrap a signal using signals of a shorter calculation length while the longer calculates, using a daily close price from google/yahoo if available, and so forth :

bootstrap a signal (no feed - less paitient)
1. add a signal
2. add same signal but w/ a shorter calculation interval
3. add branched signal to to use #2 until #1 has data
4. link branched signal to other signals or actions
5. wait for data to populate #2

bootstrap (no feed - impaitient)
1. add signal
2. add an approximate/representative/correlated signal that is immediately available (eg some previous close, summaries of previous closes, etc)
3. add branched signal to use #2 until #1 has data
4. link branch to other signals or actions
5. no waiting

Please Control+H if you have questions about this or any signal.

Discretionary Designs

(see the video 2:40 mark for discretionary design examples)


Any design can have discretionary signals which are changed by the user during trading.

This can be useful to manually fire an entry or exit, change position sizing, toggle source signals, and more.

Presently discretionary signals only are supported for truth/on/off signals.    

To add discretionary signals, choose signal -> other -> discretionary.    Then select which signals you want to allow toggling during trading.

When discretionary signals are supported, you can right click in the signal window (in Glean).  

Please Control+H if you have questions about this or any signal.

Design Notes


Notes are useful to provide reminders on how to trade your design, document the operation of your design, or provide links to external documentation via websites.

To add a note : add signal > other > note.

Supply a name, the note information and an optional URL.

Note that if a URL is provided, editing the note will cause the URL to open rather than allowing you to change the design.    In this case if you later need to change the note, you should delete and recreate it.

Please Control+H if you have questions about this or any signal.

Branched Signals


Branched signals help you maintain clean designs by separating signal calculations.

They can be added via add signal > other > branch.

The most common example for a branch is getting a price or size, where the price or size calculation changes as your strategy changes.

This is common in pairs trading, where entry and exit prices for the pair switch from the bid to the ask based on whether you're in a position.

For example, compute a price that takes the ask + .02 on entry and hits the bid - .02 on exit.
  1. add a simple signal to hold your .02 delta
  2. compute entryprice = ask +delta
  3. compute exitprice = bid - delta
  4. add position signals (add account > position) to get position state
  5. add branch called price that when you are flat takes the value of entryprice, and when you are not takes the value of exit price
Please Control+H if you have questions about this or any signal.

CSV Signals

You can populate the values of signals from a CSV file.    This is useful to create signals quickly, when you have many signal values that vary on a per security basis, or to work with multi symbol strategy such as pairs or basket strategies.

CSV Requirements


The CSV file must have a header that contains a column called symbol or sym (case does not matter), and as many other columns as you like.

The rows of your CSV file must contain a symbol and whatever other signal values you want to associate with the symbol.   An example of a CSV file is included in the folder you installed Glean (TestRDCsv.csv) or here.

Populating Signals from CSV


Once you have created and saved your CSV file, you add it to your design like add signals > other > csv.    Specify the file, glean will tell you if any problems are found in your CSV.

Editing CSV Files


If you have problems with your CSV file, try using the included example which already works and modifying it to meet your needs.    

There is also a CSV editor in glean (view > designs + data > csv editor > open csv file), which makes editing CSVs less error prone.

CSV Signals Explained


When your CSV is linked to your design, it will automatically create a signal corresponding to each column.    When you trade a symbol on the design, if the design's symbol is listed in the CSV file it will take the signal value from the row corresponding to your signal.   

CSV Signal Example


Given this CSV file :

symbol,entrysize,entryprice
ibm,100,200
ge,1,50

Anytime you trade GE the entrysize signal will hold 100, and when trading GE will hold 1.   If you traded a symbol not listed in the CSV, it would take the default value of the signal (which you can change the same way you change any signal default, by double clicking the signal and changing the value).

CSV Notes

Presently CSV files are stored locally on your machine, not with your design in the cloud.

As such, if you move machines or trade designs in ASP via a dll, you will need to move the CSV file on the machine in the same directory folder as when you created the design.

Please Control+H if you have questions about this or any signal.

DLL To Signals

Dll signals allow you to interface c and c++ code to Glean directly.

Glean allows you to provide the header file for dlls that holds the names of the functions your dll exports and what types of arguments it needs.

When you add a dll signal (add signal > other > dll), you provide the dll and header location.    It reads the header to find all the functions exported by your dll.

To map a given function to input signals, simply choose the desired dll function and then select each function argument and it's matching input signal.

If you forget an input, it will be marked as pink and glean will not allow you to accept the dll signal until all the pink options have been cleared.

Output signals will be automatically created once you accept the dll.

DLL Signal Example


An example c dll is provided in the folder you installed Glean called TestDLL2Signal.    You will need Visual c++ express or visual studio to edit this solution.    

The example includes two exports and you can use it to adapt your own code.

DLL Notes


Similiar to CSVs, dlls are presently stored locally and not in the cloud so if you move machines or trade via a dll, make sure the dlls are provided in the same folder as on your design machine.


Please Control+H if you have questions about this or any signal.

Signal Views

Signal views help you design by limiting the signals you can see at any given time.

This can be useful in verifying a calculation, in diagnosing why a given action fired or didn't or why a combine calculated the way it did, or in developing discretionary trading signals.

Adding a Signal View


To add a signal view :
  1. add > other > signal view.
  2. name the view
  3. from your signals on the left, choose which signals you want to see in the view
  4. once you have your signals selected, adjust their order as needed
  5. accept the signal view when ready.
  6. once a signal view has been added, anytime you play the design in historical or live view you will have a signal view drop down that will show only those signals in your view.

Quick Signal Adds

If you want to visually see why an action fired or how a combine calculated, create a view for the action.

To do this quickly, select the action, right click and quick add > signal view.

This will create a view for the inputs and outputs of the action or combine, so when you playback you can easily see what is going on.

Signal View Notes


Signal views are only available when testing or trading inside Glean.    If you trade in ASP and want to diagnose a particular action, load up the tick data ASP records into the historical view and then diagnose the signal or action.

Please Control+H if you have questions about this or any signal.

Plot Signals


Signal plots let you draw the value of your signal on the chart.

To plot a signal, you can right click it and quick add > plot.

Or add signal > other > plot and choose the signal you wish to plot and the type of data it contains (price or oscilations between two values).

Please Control+H if you have questions about this or any signal.

Portfolio Actions


Portfolio actions let you close your entire portfolio based on other signals.

To add simply add signal > other > portfolio action and choose your trigger conditions and exit criteria.

Please Control+H if you have questions about this or any signal.

Primary Symbol Signals

Primary symbols are needed if you want to trade a design live in glean and see the individual symbols signals.    

Adding this signal (add > other > primary symbol), simply allows the design to provide the symbol when signaling so it can visually keep each symbols signal seperate when displaying.

For the same reason, primary symbol signals are also needed if you are discretionarily triggering signals via the mouse.

Please Control+H if you have questions about this or any signal.

Random Signals

Random signals can be used as placeholders for signals that you are having developed by third parties (and may not be available at the time you start designing).

They can also be used to provide random inputs to calculations that require them.    To add a random signal, simply add > other > random.

Please Control+H if you have questions about this or any signal.

Risk Limits

Risk limits allow you to control how many symbols your design can trade, or how many dollars your design is allowed to purchase (either globally, or per symbol).

To add risk limits, add signal > other > risk limits and specify what limits you wish to enforce.

Please Control+H if you have questions about this or any signal.