EntryHandling

View as Markdown

Definition

Sets the manner in how entry orders will handle.

This property ONLY applies to Managed order methods. When IsUnmanaged is set to true, Entry Handling properties will be hidden from the UI.

Property Value

An enum which sets how the entry orders are handled. Default value is EntryHandling.AllEntries. Possible values include:

PropertyDescription
EntryHandling.AllEntriesNinjaScript will process all order entry methods until the maximum allowable entries set by the EntriesPerDirection property is reached while in an open position
EntryHandling.UniqueEntriesNinjaScript will process order entry methods until the maximum allowable entries set by the EntriesPerDirection property per each uniquely named entry

This property should ONLY be set from the OnStateChange() method during State.SetDefaults or State.Configure.

Syntax

EntryHandling

Examples

Allow a maximum of two entries while a position is open

1// Example #1
2protected override void OnStateChange()
3{
4 if (State == State.SetDefaults)
5 {
6 EntriesPerDirection = 2;
7 EntryHandling = EntryHandling.AllEntries;
8 }
9}
10
11protected override void OnBarUpdate()
12{
13 if (CrossAbove(SMA(10), SMA(20), 1)
14 EnterLong("SMA Cross Entry");
15}
16
17// EnterLong() will be processed once for each uniquely named entry.

Allow a maximum of one entry per uniquely named entry

1// Example #2
2protected override void OnStateChange()
3{
4 if (State == State.SetDefaults)
5 {
6 EntriesPerDirection = 1;
7 EntryHandling = EntryHandling.UniqueEntries;
8 }
9}
10
11protected override void OnBarUpdate()
12{
13 if (CrossAbove(SMA(10), SMA(20), 1)
14 EnterLong("SMA Cross Entry");
15
16 if (CrossAbove(RSI(14, 3), 30, 1)
17 EnterLong("RSI Cross Entry");
18}