Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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

    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 sightcareclickhere, Today, 01:55 PM
                0 responses
                1 view
                0 likes
                Last Post sightcareclickhere  
                Started by Mindset, 05-06-2023, 09:03 PM
                9 responses
                258 views
                0 likes
                Last Post ender_wiggum  
                Started by Mizzouman1, Today, 07:35 AM
                4 responses
                18 views
                0 likes
                Last Post Mizzouman1  
                Started by philmg, Today, 01:17 PM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_ChristopherJ  
                Started by cre8able, Today, 01:01 PM
                1 response
                9 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Working...
                X