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

Can I remove Fibonacci price levels?

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

    Can I remove Fibonacci price levels?

    Can I remove the price levels so I only see the percentage without having to play with the code in Ninjascript as I am not keen to do that

    thankyou

    #2
    Hello Christopher Leggit,

    Thanks for your question.

    There would not be a way to remove the price levels without copying the Fibonacci Drawing tool and modifying it to change what text is shown.

    Please let us know if you have any additional questions.
    Last edited by NinjaTrader_Jim; 11-16-2021, 07:40 AM.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hi Jim,
      Thank you for the quick reply, I had already had a good look and a fiddle with the 1000+ lines of code I saw a lot of "pricelevel" and commented out certain areas of code but it was removing the price and also the fib percentages. I've just gone over it another two times and accomplished the same. Could you point me in the right direction If I should aim my concentration at a certain area of the code.
      I have edited CurrentOHL, PriorOHLC and the AWO Median to only show todays high as "TH" and so on. I'm using Add Plot Names indicator max margin of 200 the fib percentages would fit perfectly.
      I'm not after the answer just a push in the right direction, having a crack at this is beyond beginners I just need to remove the price as it occasionally covers my pivots and others its very distracting.
      Hope that's not to much
      Click image for larger version

Name:	NinjaSupport.jpg
Views:	531
Size:	147.2 KB
ID:	1178708

      Thank you Jim
      Attached Files
      Last edited by Christopher Leggit; 11-16-2021, 11:37 AM.

      Comment


        #4
        Hello Christopher Leggit,

        Sure thing. (I also moved this thread back to a NinjaScript Development forum. I did not realize you wanted to venture down this path when you opened your thread.)

        Firstly, you will want to make a copy of the script (inside the code editor, Right Click > Save As) and then you will need to make each class copied unique. You may attempt compiling and use the compile errors to point out where the now duplicate classes are created so you can make them unique.

        You will receive more compile errors after this, particular for the NinjaScript methods where they are implemented at line 1355 of FibonacciTools.cs (or now in your copy.)

        public static partial class Draw...

        You may comment this out and work on this later if you want to implement the NinjaScript drawing tool methods for your modified Drawing Tool.

        Now that your copy is compiling, you can attempt some modifications.

        DrawingTools use SharpDX for rendering and we want to look for TextLayouts that would be related to drawing the price level text. The string provided when the TextLayout is created will determine the message given.

        In FibonacciRetracements, the TextLAyout is drawn on line 429:

        RenderTarget.DrawTextLayout(new SharpDX.Vector2((float)drawAtX, (float)(y - textFormat.FontSize - edgePadding)), textLayout, priceLevel.Stroke.BrushDX, SharpDX.Direct2D1.DrawTextOptions.NoSnap);

        textLayout is bolded and this is created on line 412:

        SharpDX.DirectWrite.TextLayout textLayout = new SharpDX.DirectWrite.TextLayout(Core.Globals.Direct WriteFactory, str, textFormat, layoutWidth, textFormat.FontSize);

        It is given the string str which is assigned a value on line 406:

        string str = GetPriceString(price, priceLevel);

        There is a friendly method used in the script called GetPriceString(). This is what you will need to modify and you may find the method on line 480:

        private string GetPriceString(double price, PriceLevel priceLevel)

        In this method, we can see priceStr contains the price, and then pct is added to the resulting string.

        You can then blank out priceStr in order to remove the price portion from the price level text.

        We look forward to assisting.
        JimNinjaTrader Customer Service

        Comment


          #5
          H Jim,

          I commented out priceStr after using ); before it to close the string
          I use retracements and extensions only, If what I have done here on line 485 for retracements is correct I have also done on line 857 For extensions and It has disabled the Fibonacci's from being drawn, I have tried different variations of "blanking/commenting/removing" areas within this method.

          Click image for larger version  Name:	NinjaSupport.jpg Views:	0 Size:	107.6 KB ID:	1178757
          Last edited by Christopher Leggit; 11-16-2021, 08:56 PM.

          Comment


            #6
            Hello Christopher Leggit,

            I had meant blank out, as in make the string blank.

            If your modifications are causing the drawings to disappear, please check the log tab of the Control Center for errors that hint at where the problem is and what the problem is.

            I can tell by looking at your code that you are using String.Format() with two elements, {0} and {1}, but you commented out the portion using priceStr, so only 1 element is given. This will produce a run time error

            A publicly available resource on using String.Format() can be found here - https://www.c-sharpcorner.com/Upload...ng-in-C-Sharp/
            JimNinjaTrader Customer Service

            Comment


              #7
              Hi Jim,

              It's been 11 days finally done.
              After changing the classes so it would compile I was embarrassed to find what took me 11 days quite literally took 10 seconds
              Thank you very much for the assistance and patience I had a brain operation when I was 21 coding is going to be a slow path for me.
              I don't have short term memory loss so I wont end up asking the same questions in the future I do retain what I learn thankfully.
              Thank you again Jim

              Kind Regards

              Christopher

              Comment


                #8
                Bellow is What I wanted to accomplish, I have changed each name in other indicators so when I use Add Plot Names it shows
                I go off candlestick analysis so no need for the price plotted
                todays current - TO,TL,TH
                prior day - YO,YH,YL,YC
                Median - 50%
                and so on
                maximum right side margin is 200 and I wouldn't want it any bigger
                So the Fibonacci's fit perfectly

                Click image for larger version

Name:	NinjaSupport.jpg
Views:	486
Size:	327.2 KB
ID:	1179740

                thank you Jim

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by geddyisodin, Today, 05:20 AM
                2 responses
                16 views
                0 likes
                Last Post geddyisodin  
                Started by hazylizard, Today, 08:38 AM
                0 responses
                7 views
                0 likes
                Last Post hazylizard  
                Started by Max238, Today, 01:28 AM
                5 responses
                43 views
                0 likes
                Last Post Max238
                by Max238
                 
                Started by giulyko00, Yesterday, 12:03 PM
                3 responses
                13 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by habeebft, Today, 07:27 AM
                1 response
                16 views
                0 likes
                Last Post NinjaTrader_ChristopherS  
                Working...
                X