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 sjsj2732, 03-23-2026, 04:31 AM
          0 responses
          49 views
          0 likes
          Last Post sjsj2732  
          Started by NullPointStrategies, 03-13-2026, 05:17 AM
          0 responses
          300 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          294 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          139 views
          1 like
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          98 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Working...
          X