• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

adding new time frame to strategy

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

    adding new time frame to strategy

    Problem:
    I'm trying to reference multiple time frames in a strategy. What I would like to do is trade in a 5 minute time frame, but I would like to check a daily time frame to see if a condition is met by an indicator, and if so I want to cease trading (ie. if the market is doing something that has proven to make my 5 minute strategy ineffective, I would like to stop trading until normalcy returns).

    My issue is that my code stops running the instant I add the line for the new period

    Code:
      protected override void Initialize() 
      { 
    Add(PeriodType.Day, 1);
     }
    Without this line, the strategy runs, but as soon as this is added it stops working. I have not even tried to call this later in the code yet. All I've tried to do is add this line of code to the initialization and it still kills my script. I have tried changing the period to minute, day, etc and it makes no difference.

    Synopsis:
    I am running back tests off of imported data. The strategy will run in both 5 minute or daily time frame separately just fine. As soon as code is added for new time period it all stops working.

    Can someone give me any idea what I might be missing that is causing this to kill my script?

    Thanks in advance

    #2
    Hello jordis,
    Welcome to the forum and I am happy to assist you.

    If you open the output window (tools>output window) and then test the strategy then are you getting any error messages in the output window.

    I look forward to assisting you further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      hi,

      the output window shows no errors or any messages at all

      i checked the output window both while compiling and while backtesting the strategy.


      no messages in output window, no messages in log



      thanks for your help

      Comment


        #4
        Hello jordis,
        To assist you further can you please send a toy NinjaScript code* replicating the behavior to support[AT]ninjatrader[DOT]com

        Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.

        I look forward to assisting you further.

        *The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.
        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jeronymite, Today, 04:50 PM
        0 responses
        4 views
        0 likes
        Last Post jeronymite  
        Started by daigo1, Today, 04:41 PM
        0 responses
        6 views
        0 likes
        Last Post daigo1
        by daigo1
         
        Started by Harrylwd4, Today, 03:15 PM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by concept, Today, 04:22 PM
        1 response
        12 views
        0 likes
        Last Post concept
        by concept
         
        Started by Gregorian, Today, 02:05 PM
        4 responses
        17 views
        0 likes
        Last Post Gregorian  
        Working...
        X