Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

printing indicator results

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

    printing indicator results

    I believe I have a farely simple question. I made an indicator that works fine. It prints on my charts fine. My problem is I want only a range of the results to print, not all results. For example: now it prints -n to 0 to n. No results are eliminated. I want it to print, for example, >=3 and <=-3. I don't want all the noise around the zero area.

    I know this is done all the time but I don't know how to change my code to make this happen. Can someone tell me how to do this?

    Thanks in advance,
    C

    #2
    Hello C,

    Where you have your print. Put this in the action block of an if statement that checks the value of your variable being greater than -3 or less than 3.

    if (myVar >= -3 && myVar <= 3)
    {
    Print("my print here");
    }
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Couple things:

      I can't tell if you made a typo. I said >=3 and <=-3 and you replied >= -3 && myVar <= 3. Did you mean to write this?

      Secondly, I don't know where to put the IF statement. Here is my print code. Does it go within or before? I keep getting errors.

      DrawText("imbalance" + CurrentBar, AutoScale, (+ imbalance).ToString(), 0, High[0], 14, Color.Pink, ChartControl.Font, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);

      Thank you,
      C

      Comment


        #4
        Originally posted by imalil View Post

        DrawText("imbalance" + CurrentBar, AutoScale, (+ imbalance).ToString(), 0, High[0], 14, Color.Pink, ChartControl.Font, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);

        Thank you,
        C
        I'm not sure what (+) does, I don't feel like testing. (I suspect nothing)



        Code:
        if ((+ imbalance) >= 3 || (+ imbalance) <= -3)
        {
        
        DrawText("imbalance" + CurrentBar, AutoScale, (+ imbalance).ToString(), 0, High[0], 14,				Color.Pink, ChartControl.Font, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
        }
        if it doesn't work - try this:


        Code:
        if ( imbalance = 3 ||  imbalance <= -3)
        {
        
        DrawText("imbalance" + CurrentBar, AutoScale, (+ imbalance).ToString(), 0, High[0], 14,				Color.Pink, ChartControl.Font, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
        }
        Last edited by sledge; 08-26-2015, 09:32 PM. Reason: 1st) fixed condition from and to or, 2nd) fixed extra ) in code

        Comment


          #5
          Thank you very much.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          596 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          343 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          556 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          554 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X