• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

clear text on the chart

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

    clear text on the chart

    Hi,
    i use DrawTextFixed to draw a text to the chart and works well.
    But after every OnBarUpdate the new text to draw is draw above the previous one.
    A DrawTextFixed without a text don't do the trick ???

    #2
    Hello mate41,

    Would it be possible for you to provide a small code sample?

    If your tag - your first argument - is the same between DrawTextFixed calls, your old DrawTextFixed object should be overwritten. I am including a link to the documentation in the NinjaScript help guide

    http://ninjatrader.com/support/helpG...wtextfixed.htm
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Hi Mate41,
      Can you put the source in here...I am also trying to plot on chart not working. Just want to compre what I am doing wrong.

      Comment


        #4
        Here is the code: (NO is the code for "0" decimal)

        Code:
        DrawTextFixed("Indicators","\n\n\n\n\nRSI=" + rsiValue.ToString("N0")+"  IMI=" + imiValue.ToString("N0")+"  MFI=" + mfiValue.ToString("N0")+ "  Stos=" + stosValue.ToString("N0")+"  Bol%=" + bolPerc.ToString("N0")+"\n\n", TextPosition.BottomLeft,Color.Blue,indicFont,Color.Transparent, Color.Transparent,0);
        This line of text is draw ABOVE the previous one after every OnBarUpdate.
        Attached Files
        Last edited by mate41; 01-26-2016, 10:19 AM.

        Comment


          #5
          Since I do not have access to your private variables, I attempted to use the following :

          Code:
          private int test = 0;
          
          protected override void OnBarUpdate()
          {
             DrawTextFixed("Indicators","\n\n\n\n\nRSI=" + (++test) + "  IMI=" + (++test) + "   MFI=" + (++test) + "  Stos=" + (++test) + "  Bol%=" + (++test) + "\n\n", TextPosition.BottomLeft,Color.Blue,new Font("Arial", 20),Color.Transparent, Color.Transparent,0);
          }
          This code did not reproduce what you are describing.

          Would it be possible for you to give me a code sample with all your variables defined, which includes every instance of your using DrawTextFixed? If that is not possible, could you modify my code sample so that it reproduces the behavior you observed?
          Jessica P.NinjaTrader Customer Service

          Comment


            #6
            What more code but there are existing indicators called like rsi and so on and there is no problem about that.
            All is printed (on the chart), so no problem.
            Only the next print is printed above the previous as i said early.

            Code:
            if (CurrentBar == 0) return;
                        // calculation
                       
                        double bolPerc = BollingerPercB(bPercOB, bPercOS,bPeriod,bStDev)[0];
                        double rsiValue = RSI(rsiPeriod,rsiSmooth)[0];
                        double imiValue = IMI(imiAvgP,imiPeriod,false)[0];
                        double mfiValue = MFI(mfiPeriod)[0];
                        double z = MarketData.Last.Price;
                        double stosValue = Stochastics(stosPeriodD, stosPeriodK,stosSmooth).K[0];
            ..../......
                        Font txtFont = new Font("Deja Vu Sans Mono", textSize, FontStyle.Bold);
                        Font indicFont = new Font("Deja Vu Sans Mono", 8, FontStyle.Bold);
            DrawTextFixed("Indicators","\n\n\n\n\nRSI=" + rsiValue.ToString("N0")+"  IMI=" + imiValue.ToString("N0")+"  MFI=" + mfiValue.ToString("N0")+ "  Stos=" + stosValue.ToString("N0")+"  Bol%=" + bolPerc.ToString("N0")+"   \n\n", TextPosition.BottomLeft,Color.Blue,indicFont,Color.Transparent, Color.Transparent,0);
            See attached screenshot.
            Clearing the textline before write the new would be a solution ???
            Attached Files
            Last edited by mate41; 01-26-2016, 12:37 PM.

            Comment


              #7
              I need to be able to reproduce what you are seeing on my end in order to advise further. I need a code sample I can compile and run in order to do this. I can not compile and run your sample.

              If you believe you have a strategy that may work, please try it out and post your findings here.
              Jessica P.NinjaTrader Customer Service

              Comment


                #8
                Problem SOLVED....
                There was nothing wrong with the code.
                A close and open of the chart solved the problem....... ???
                Sorry for the noise.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by dr0832, 01-04-2019, 10:34 AM
                7 responses
                141 views
                0 likes
                Last Post Lancer
                by Lancer
                 
                Started by cbentrikin, Today, 07:46 PM
                0 responses
                4 views
                0 likes
                Last Post cbentrikin  
                Started by RedDuke, Today, 06:14 PM
                0 responses
                4 views
                0 likes
                Last Post RedDuke
                by RedDuke
                 
                Started by DariusDeck, Today, 04:22 PM
                1 response
                13 views
                0 likes
                Last Post NinjaTrader_Marco  
                Started by pstrusi, Today, 05:05 PM
                1 response
                3 views
                0 likes
                Last Post pstrusi
                by pstrusi
                 
                Working...
                X