Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

2 Buttons that place 2 different Fib. Ret. configurations

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

    2 Buttons that place 2 different Fib. Ret. configurations

    Dear Support

    Is this even possible?

    I'd like to create 2 buttons that use the retracement tool. These can be either in the toolbar or on the chart.

    When when selected they will place either of 2 different Fib Retracement configurations i.e.

    Button 1 places the retracement with a 62 Red and a 78 Blue configuration.
    Button 2 places a Red 32 and a Green 50 configuration.

    I'd greatly appreciate your thoughts as to whether this is possible along with some guidance.

    Many thanks.

    #2
    Hello PH_GMT,

    Thank you for your post.

    This would be possible, you can create custom buttons from within an indicator.



    To call draw objects from within the code, that would require accessing data outside of a data driven method so you'll need to use TriggerCustomEvent so that internal NinjaScript indexes and pointers are correctly set prior to processing user code triggered by your custom event.

    Below is a post that demonstrates this.

    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      Gaby, thank you so much for such a quick and helpful reply.

      I'm moving to NT from Sierra and although I'm quite confident with ACSIL C++ I have absolutely no skills relative to C# .net and wpf (yet).

      I'll look through those links carefully and start learning C# / wpf.

      Is there any additional help or direction you can provide in addition to those 2 links while this post is still current?

      Maybe something related to the inclusion of an NT tool?

      Many thanks.

      Comment


        #4
        Hello,

        Do you have some specific information you have in mind, what do you mean by "NT tool"? Below I'm also going to provide some general "getting started" info.

        The above post provides sample code for creating a button from an indicator and calling TriggerCustomEvent() to make sure the internal NS indexes are up-to-date at the moment the button is clicked.


        If you are new to C#, to get a basic foundation for the concepts and syntax used in NinjaScript I would recommend this section of support articles first:
        Basic Programming Concepts

        For general C# education I have personally found Dot Net Perls to be a great reference site with easy to understand examples.


        We also have great resources in relation to Strategy Development on our Support Forum. There is a very active developer community in our support forum that supplements the responses provided by NinjaTrader support staff providing all users with an exceptional support experience.
        Take me to your support forum!

        There are a few Sample Automated Strategies which come pre-configured in NinjaTrader that you can use as a starting point. These are found under New -> NinjaScript Editor -> Strategy. You will see locked strategies where you can see the details of the code, but you will not be able to edit (you can though always create copies you can later edit via right click > Save as)

        We also have some Reference samples online as well as ‘Tips and Tricks’ for both indicators and strategies:
        Click here to see examples created by the support team
        Click here to see our NinjaScript Reference Samples
        Click here to see our NinjaScript Tips

        These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.

        Also, below I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript.


        Further, the following link is to our help guide with an alphabetical reference list to all supported methods, properties, and objects that are used in NinjaScript.
        Alphabetical Reference

        And our Educational Resources in the NinjaTrader 8 help guide.
        Educational Resources

        A set of specific tutorials for creating conditions in the NinjaTrader 8 Strategy Builder in the NinjaTrader 8 help guide.
        Condition Builder

        I'm also providing a link to a support article with further helpful resources on getting started with C# and NinjaScript.


        Please let me know if I may answer any specific questions for you throughout your journey of becoming a NinjaScript Developer.
        Gaby V.NinjaTrader Customer Service

        Comment


          #5
          Thank you Gaby, that's really helpful.

          I realise the answer will unfold as I read through your links but can I just ask. Will this be an indicator or strategy.

          Many thanks.

          Comment


            #6
            Strategies are generally meant for automated trading, so this would likely be better as an indicator script.
            Gaby V.NinjaTrader Customer Service

            Comment


              #7
              Great that's all working and moving forwards. :-).

              However, having moved on a little from Indicators and Drawing Tools.

              What I'd like to do is call the "myRectangle" tool that resides in Drawing Tools and is currently accessed by selecting drawing tools >> "myRectangle."

              I have loaded the recommended "SampleAddButton" script but in the "on click" the code seems to suggest it will change the button text from "Buy/Sell" to "clicked" in the on click event which it doesn't, so I'm a little confused.

              I realise you rarely provide working examples due to time restraints but would you be able to provide an edit or directions as to how I can launch the "myRectangle" drawing tool from a single button.

              Many thanks.​

              Comment


                #8
                Hello,

                The example does not change the button text (it is not supposed to either), it prints "Clicked" to the output window. The script merely demonstrates how to implement a button in your indicator script, if you want to to take a different action you will need to create your own event handler for when the button is clicked that takes a different action (like calling a Draw method).
                Gaby V.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Gaby,

                  Thank you for clarifying unfortunately my NT trial is just about to end so I doubt I'll have enough time to explore further.

                  I have been able get so far but not being proficient in C# I'm left wondering if its even possible. I think not or there would be more examples provided.

                  I can't believe that a product that has been around so long has so little basic code examples for real world applications like calling a Draw method from an on-click procedure. I've looked but could find nothing.

                  TradingView has pages of examples re PineScript whereas NT over many more years has pretty much nothing.

                  Best I stay with Sierra Chart as I'm comfortable with ACSIL C++.

                  Comment


                    #10
                    SEEMS LIKE YOU'VE BEEN SENDING ME DOWN A RABBIT HOLE.

                    POOR SHOW FROM NINJATRADER SUPPORT!

                    06-03-2016, 07:24 AM
                    FatCanary,

                    No I don't think it is bug a mate... I think it was never designed to expose this functionality to Add Ons.
                    The ChartDrawingToolCommands class used here:
                    Code:NinjaTrader.Gui.Chart.ChartDrawingToolCommand s.Line.Execute(this);
                    Is an internal (internal as in designed for use by NT not 3rd party developers like us, the class itself is actually public as far as accessibility goes) static class, and the properties like Line are ICommand's
                    Codeublic static ICommand Line;
                    Then they have set these up as follows in the static constructor of the ChartDrawingToolCommands class:
                    Code:ChartDrawingToolCommands.Line = new RoutedCommand("Line", typeof(ChartDrawingToolCommands));
                    In order to use the command in an application, event handlers which define what the command does must be created. We need an example of what to put in these event handlers to implement our own solution.
                    This is what I have asked NT/Patrick for.... maybe his is waiting on the dev team to get back to him with an answer....

                    But as yet we have no solution for this or any of the other items on the list....

                    Regards,

                    codeowl
                    Last edited by codeowl; 06-04-2016, 03:03 AM.​

                    Comment


                      #11
                      Hello,

                      I took a look at the post you are referencing and it looks like they are asking about drawing from an AddOn Script, not an Indicator script.

                      If you read the comment you just posted, it says: "I think it was never designed to expose this functionality to AddOns.​"

                      That is not possible (using Draw() from an AddOn), however you have posted in the Indicator Development page. It is possible to do this from an Indicator script. Additionally they were asking about a custom drawing tool, however you're asking about a built-in Fib drawing.
                      Gaby V.NinjaTrader Customer Service

                      Comment


                        #12
                        Hi Gaby,

                        The tool are already written. They are not the NT Drawing tools they are FIB1, FIB2, DRW1 and DRW2. Those are the names that appear in "Custom/Drawing Tools" folder along with the basic NT tools.


                        The button information provided is excellent what I was asking for help with was formatting the on click event to call those Drawing tools rather than having to select drawing tools etc.

                        Sorry if I confused things. Just a little frustrated as I'd hoped to resolve it all during my free trial and get up and running with NT / NT Brokerage.

                        Comment


                          #13
                          Do they show up as different tool names in the drawing tool dropdown? I've copied the code for different rectangles before, renamed them, and set them to different colors and assigned them their own hotkeys in order to use them for marking support and resistance. It wouldn't need buttons and you needing to figure out how to code your buttons since you have a free trial.It could be a workaround until you get it figured out.

                          Comment


                            #14
                            Hi, Rockmanxx0

                            Thank you for your reply.

                            The Drawing tools other than the fibs are exactly the same. They are rectangles for Support, Resistance and other Events just as you mention.

                            I wasn't able to copy and rename the code with the different parameters verbatim as some variables were replicated and NT wouldn't compile without some changes.

                            Changes made for rectangles were:

                            //public abstract class RecExtShapeBase : DrawingTool
                            public abstract class BlueRecExtShapeBase : DrawingTool
                            {​

                            and

                            Name = "Blue";


                            Did you need to do the same or was this an unnecessary step?

                            I'm not familiar with C# and Ninja script as I've been with Sierra Chart for many years and Sierra is C++ and their own additional ACSIL functions. Very powerful and very different.

                            I was getting there but I couldn't seem to get a clear solution which I doubt is more 2-3 lines of code from NT Support. I think Chelsea seems to be the most helpful but no such luck with my request.

                            Sierra support by comparison is very good, so more than a little disappointed but not surprised by the level of support at NinjaTrader.

                            --------------------------

                            To date my experience of NT Support is as follows:

                            TBH I've seen hundreds of simple user requests where support's reply is "we'll add it to the list" and years later they are still saying the same thing.

                            I don't think NT Programming or Support have any interest in their users but with TradingView growing all the time and other platforms coming on line both NT support and their programmers may find themselves looking for jobs and wishing they'd been more helpful.

                            Quite often companies that fail to listen don't realise how close they are to the cliff's edge until it's too late. Lost customers rarely return.

                            There are features on NT I would benefit by but TBH in the short time I've interacted with support I'm absolutely certain I'll move to an alterative as soon as its available. No one can have any allegiance to companies like this. Certainly not me. :-)

                            --------------------------

                            Re: hot keys as a temporary solution I hadn't gone that route as I've always been a little worried about the possible implications with other programs that are running.

                            Thank you for your help though and I've used the hot keys as suggested to provide a temporary solution. I'll let you know if I return to the Button programming.

                            Very grateful!



                            Comment


                              #15
                              Glad that you could at least get a temporary solution. I know I was able to change the rectangle tools and create a second one and customize that, but trying the same with the fib tools wasn't that simple for me. I found another post talking about FIb Tools that might have code that will at least let you create 2 different fib tools.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by michelz, 02-18-2025, 08:30 AM
                              18 responses
                              330 views
                              0 likes
                              Last Post neveral0n3  
                              Started by Schools, Yesterday, 03:32 PM
                              1 response
                              15 views
                              0 likes
                              Last Post Schools
                              by Schools
                               
                              Started by Mindset, Today, 09:58 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by llanqui, 03-05-2025, 06:03 AM
                              21 responses
                              121 views
                              0 likes
                              Last Post bltdavid  
                              Started by kujista, 03-13-2025, 12:41 AM
                              8 responses
                              45 views
                              0 likes
                              Last Post kujista
                              by kujista
                               
                              Working...
                              X