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 kaywai, 02-02-2023, 03:07 AM
        5 responses
        98 views
        0 likes
        Last Post kaywai
        by kaywai
         
        Started by sjmuk1, Today, 08:45 AM
        0 responses
        1 view
        0 likes
        Last Post sjmuk1
        by sjmuk1
         
        Started by tecmisc1, Today, 08:43 AM
        0 responses
        2 views
        0 likes
        Last Post tecmisc1  
        Started by onlinebusiness, 02-03-2023, 02:18 AM
        8 responses
        200 views
        0 likes
        Last Post NinjaTrader_Emily  
        Started by birdog, 02-02-2023, 09:32 AM
        8 responses
        120 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X