Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Selecting multiple timeframes in strategy

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

    Selecting multiple timeframes in strategy

    Hi,

    I have created a strategy which is based using multiple timeframes and it seems to work out.

    I now want to change the strategy so that the user can select which timeframes they can use .e.g 5 min + daily + weekly, rather than the hard coded ones I have entered.

    I have looked in the strategies but can not find anything that allows you to select the dataseries type, as per the backtesting of a strategy.

    The only thing that I can think of is using 'coded' user inputs to achieve this e.g. have strings of '5Minute' 'Daily' 'Weekly' to simulate the above.

    If anybody has any suggestions please let me know.

    TIA.

    Graham.

    #2
    I think I would define as all TF bolean variable then I tested it in Script, if True or False. But they should be defined through all the add TF

    Comment


      #3
      Hello,

      I haven't tested this but try adding this in your variables section:
      privateint mytimeframe = 5;

      And this in your Initialization section:
      Add(PeriodType.Minute, mytimeframe);

      I've never tried it, but it may work. Or use bool logic as suggested.
      DenNinjaTrader Customer Service

      Comment


        #4
        Thanks for the replies.

        It looks as if boolean logic seems to be the best way forward.

        Graham.

        Comment

        Latest Posts

        Collapse

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