NinjaScript > Language Reference > Strategy >

EntryHandling

Print this Topic Previous pageReturn to chapter overviewNext page

Definition

Sets the manner in how entry orders are handled. If set to "EntryHandling.AllEntries", NinjaScript will process all order entry methods until the maximum allowable entries set by the EntriesPerDirection property has been reached while in an open position. If set to "EntryHandling.UniqueEntries", NinjaScript will process order entry methods until the maximum allowable entries set by the EntriesPerDirection property per each uniquely named entry.

 

Property Value

EntryHandling.AllEntries
EntryHandling.UniqueEntries

 

Syntax

EntryHandling

 

 

Examples

// Example #1
// Will allow a maximum of two entries while a position is open
protected override void Initialize()
{
    EntriesPerDirection = 2;
    EntryHandling = EntryHandling.AllEntries;
}

 

protected override void OnBarUpdate()
{
    if (CrossAbove(SMA(10), SMA(20), 1)
         EnterLong("SMA Cross Entry");
}

 

// Example #2
// EnterLong() will be processed once for each uniquely named entry.
protected override void Initialize()
{
    EntriesPerDirection = 1;
    EntryHandling = EntryHandling.UniqueEntries;
}

 

protected override void OnBarUpdate()
{
    if (CrossAbove(SMA(10), SMA(20), 1)
         EnterLong("SMA Cross Entry");
 
    if (CrossAbove(RSI(14, 3), 30, 1)
         EnterLong("RSI Cross Entry);
}