Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changing PeriodType.Day to sync with an input

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

    Changing PeriodType.Day to sync with an input

    I have a script the I would to sync with a strategy.

    To do that I need to change from

    Add("BH ##-##", PeriodType.Day,1);

    Add("BH ##-##", PeriodType.Minute.1);

    And change the time from 1 to whatevever.

    How can I set that up from an input via a strategy? or make the indcator to work with a variable?

    #2
    tinkerz,

    I am not sure what you mean here. What are you trying to sync together? A strategy outside of an indicator, or an indicator called from a strategy?
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      What I mean is I wish to input a number or text in the indicator setup screen and use that information in the add command

      Comment


        #4
        tinkerz,

        You can simply create a string and integer as user defined input to do so, then have the string and integer in the Add method such as follows.

        Add(MyString, PeriodType.Day,MyPeriod);

        The PeriodType can be set up as user defined input, but unfortunately this is unsupported coding.

        The easiest way would be to setup a integer that selects which PeriodType you want, i.e. 1 for minute, 2 for day, etc.

        Then you can check this integer and set the Add() method period type as follows.

        Code:
        If ( periodtypeint == 1)
        {
             Add(MyString, PeriodType.Minute, MyPeriod);
        }
        else if ( periodtypeint == 2)
        {
            Add(MyString, PeriodType.Day,MyPeriod);
        }
        ....
        Adam P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        68 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        38 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        63 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        62 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        53 views
        0 likes
        Last Post CarlTrading  
        Working...
        X