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 CortexZenUSA, Today, 12:53 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by CortexZenUSA, Today, 12:46 AM
        0 responses
        0 views
        0 likes
        Last Post CortexZenUSA  
        Started by usazencortex, Today, 12:43 AM
        0 responses
        2 views
        0 likes
        Last Post usazencortex  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        168 responses
        2,262 views
        0 likes
        Last Post sidlercom80  
        Started by Barry Milan, Yesterday, 10:35 PM
        3 responses
        10 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X