Handles trigger evaluation within trading systems.
Namespace:
RightEdge.CommonAssembly: Common (in Common.dll) Version: 2010.1.0.0 (2010.1.0.0)
Syntax
| C# |
|---|
[SerializableAttribute] public class TriggerManager |
| Visual Basic (Declaration) |
|---|
<SerializableAttribute> _ Public Class TriggerManager |
| Visual C++ |
|---|
[SerializableAttribute] public ref class TriggerManager |
Remarks
An instance is created within the SystemData and there
should rarely be a need to create this independently.
Examples
Accessing triggers within a system
CopyC#
CopyVisual Basic.Net
// Create the trigger in the Startup() function public override void Startup() { // Creates a crossover trigger. This assumes that the two // series named SMA5 and SMA20 are created and valid. Triggers["SMAX"].CreateTrigger(new CrossOver()); Triggers["SMAX"].SetSeriesInputs("SMA5","SMA20"); // ... } // Evaluating the trigger in the NewSymbolBar() function public override void NewSymbolBar(Symbol symbol, BarData bar) { // Whenever our trigger is hit, open a new position if (Triggers["SMAX"][symbol].IsTriggered) { SystemData.OpenPosition(symbol, PositionType.Long, OrderType.Market); } }
Public Overloads Overrides Sub Startup() ' Creates a crossover trigger. This assumes that the two ' series named SMA5 and SMA20 are created and valid. Triggers("SMAX").CreateTrigger(New CrossOver) Triggers("SMAX").SetSeriesInputs("SMA5", "SMA20") End Sub ' Evaluating the trigger in the NewSymbolBar() function Public Overloads Overrides Sub NewSymbolBar(ByVal symbol As Symbol, ByVal bar As BarData) ' Whenever our trigger is hit, open a new position If Triggers("SMAX")(symbol).IsTriggered Then SystemData.OpenPosition(symbol, PositionType.Long, OrderType.Market) End If End Sub