Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 ender_wiggum, Today, 09:50 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by rajendrasubedi2023, Today, 09:50 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by geotrades1, Today, 10:02 AM
        0 responses
        4 views
        0 likes
        Last Post geotrades1  
        Started by bmartz, Today, 09:30 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by geddyisodin, Today, 05:20 AM
        3 responses
        25 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X