Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Return spread

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

    Return spread

    Code:
                double a,b,c;
                // Use this method for calculating your indicator values. Assign a value to each
                // plot below by replacing 'Close[0]' with your own formula.
                
                b = (Closes[1][0]/CurrentDayOHL(BarsArray[1]).CurrentOpen[0]-1);
                c = (Closes[0][0]/CurrentDayOHL(BarsArray[0]).CurrentOpen[0]-1);
                a = b - c;
                
                {
                Values[0].Set(a);
                Values[1].Reset();
                }
    hi the above code works fine on 1 min data series. but it doesnt work on 2/3/4/5/60 min etc. any idea why? This is an indicator

    Initialize has
    Code:
                Add("NQ 12-14", PeriodType.Minute, 1);

    #2
    Hello calhawk01,

    Thank you for your post.

    What is occurring that is unexpected with higher intervals?

    Are you receiving any errors? If so, what do these errors report?

    Comment


      #3
      Originally posted by NinjaTrader_PatrickH View Post
      Hello calhawk01,

      Thank you for your post.

      What is occurring that is unexpected with higher intervals?

      Are you receiving any errors? If so, what do these errors report?

      the unexpected with higher intervals is that there is no output. indicator does not calculate anything.

      i don't see any errors. how can i see this in the output screen?

      TraceOrders = true; only works for strategies
      Last edited by staycool3_a; 12-28-2014, 08:11 PM.

      Comment


        #4
        Hello calhawk01,

        TraceOrders would not work for an indicator. Try using Print() to print the values: http://www.ninjatrader.com/support/h.../nt7/print.htm

        Comment


          #5
          Originally posted by calhawk01 View Post
          Code:
                      double a,b,c;
                      // Use this method for calculating your indicator values. Assign a value to each
                      // plot below by replacing 'Close[0]' with your own formula.
                      
                      b = (Closes[1][0]/CurrentDayOHL(BarsArray[1]).CurrentOpen[0]-1);
                      c = (Closes[0][0]/CurrentDayOHL(BarsArray[0]).CurrentOpen[0]-1);
                      a = b - c;
                      
                      {
                      Values[0].Set(a);
                      Values[1].Reset();
                      }
          hi the above code works fine on 1 min data series. but it doesnt work on 2/3/4/5/60 min etc. any idea why? This is an indicator

          Initialize has
          Code:
                      Add("NQ 12-14", PeriodType.Minute, 1);
          Where is, and how is, your CurrentBars check coded?

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          81 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          42 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          64 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          68 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          55 views
          0 likes
          Last Post CarlTrading  
          Working...
          X