Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time Trail

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Time Trail

    Hi, is there a a way to set a time trail on Strategy builder? For example, after entering a trade, exit the position 2 minutes later.

    #2
    Hello fercgv,

    If the chart is a minute chart you could wait two bars.

    Select Misc > Bars since entry on the left, Equals, Misc > Numeric value with 'Numeric value' set to 2 on the left.

    If the chart is not a minute chart, you would need to unlock the script and code by hand.

    private DateTime entryTime;

    In OnStateChange():
    else if (State == State.Configure)
    {
    AddDataSeries(BarsPeriodType.Minute, 1);
    }

    In OnBarUpdate():
    if (BarsInProgress == 0 /* && conditions to enter */)
    {
    EnterLong();
    entryTime = Time[0];
    }

    if (BarsInProgress == 1)
    {
    if (Position.MarketPosition == MarketPosition.Long && Time[0].Subtract(entryTime).Minute >= 2)
    {
    ExitLong();
    }
    }
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    116 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    61 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    40 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    43 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    82 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X