Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is it possible to stop Indicators with code?

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

    #16
    Hi paruchuriphani,

    Does this mean you would like to prevent orders from being executed if the data is historical?

    This can be done using if (!Historical).

    For example:
    Code:
    if (!Historical && Close[0] > Open[0])
    EnterLong(Close[0]);
    or to prevent all code from executing in the OnBarUpdate, place at the beginning:
    Code:
    if (Historical)
    return;
    Let me know if I can still be of assistance.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #17
      Hi Chelsea,

      Thank you for reply

      i want to prevent all my code from executing in the OnBarUpdate.it means i don't want to plot any downarrows and uparrows in my chart.

      i update my code like this but it is not working.


      DateTime stopDate = DateTime.Parse("2013-03-06 12:25:00").AddDays(0);
      if ((Time[0]) > (stopDate))
      if (Historical)
      return;

      Comment


        #18
        Hi paruchuriphani,

        The code you have now nests the if (Historical) inside the if ((Time[0]) > (stopDate)).
        This will only return if Time[0] is greater than the stopDate AND the data is historical.

        To correct this, try the following:
        Code:
        DateTime stopDate = DateTime.Parse("2013-03-06 12:25:00");
        If (Historical || (Time[0] > stopDate))
        return;
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        608 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        355 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        560 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        561 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X