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 CarlTrading, 03-31-2026, 09:41 PM
          1 response
          156 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          90 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          140 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          130 views
          1 like
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          107 views
          0 likes
          Last Post CarlTrading  
          Working...
          X