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 charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          67 views
          0 likes
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          149 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          162 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 05-10-2026, 08:12 PM
          0 responses
          99 views
          0 likes
          Last Post CarlTrading  
          Started by Hwop38, 05-04-2026, 07:02 PM
          0 responses
          286 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Working...
          X