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 terofs, Yesterday, 04:18 PM
        1 response
        21 views
        0 likes
        Last Post terofs
        by terofs
         
        Started by CommonWhale, Today, 09:55 AM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by Gerik, Today, 09:40 AM
        2 responses
        7 views
        0 likes
        Last Post Gerik
        by Gerik
         
        Started by RookieTrader, Today, 09:37 AM
        2 responses
        13 views
        0 likes
        Last Post RookieTrader  
        Started by alifarahani, Today, 09:40 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X