• 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

Is it possible to enter a position using an indicator and NOT a strategy?

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

    Is it possible to enter a position using an indicator and NOT a strategy?

    Hello,

    Is it possible to create an indicator to enter a position that is tied to an ATM strategy and enter positions NOT using a strategy?

    Thanks,

    Adam

    #2
    Why would you not want to use a strategy anyways?

    What would you gain?

    There is a reason for the separation.

    Comment


      #3
      Hello,

      In NT8 this would be possible using the Addon base methods.

      For a syntax example you can see this document: http://ninjatrader.com/support/helpG...tmstrategy.htm

      A strategy simplifies repetitive orders by allowing the logic to be executed after enabling and also has properties for specific account related items. In regard to doing this type of logic outside of a strategy, you are going to be doing a lot more of your own logic because you take the Strategy out of the mix.

      The addon sample provided about also entails you know how to get the Account object to place an order etc. I just wanted to mention this as Sledge had said there is a reason for separation and in the case you do not need extra work, a strategy is always the more simple way to go.

      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #4
        Thank you Jesse... would it also be possible to add a button to the Chart Trader window to execute those custom orders?

        I already have the logic developed and it works with a strategy, the problem comes when using the other buttons to scale in or out of a position. The close button is currently set to disable strategies.

        I would like to just use regular orders and not strategies to fix this problem as well as to co-locate buttons in 1 place.

        Comment


          #5
          Hello,

          You could do that as well, in this case you could use either an indicator or an addon depending on the use case.
          Consider if the result should be only on 1 chart where the indciator is applied, or on all charts even where there are no indicators applied (like a native tool).

          A indicator would work best to modify a single chart, an addon would work best to modify the entire platform or all windows of a type.

          There is already an example of adding a button to the chart trader from an indicator here: http://ninjatrader.com/support/forum...7&postcount=23

          This sample is old, so you would need to change the line:

          Code:
          this.Dispatcher.Invoke(() =>
          to

          Code:
          this.Dispatcher.InvokeAsync(() =>
          to ensure this still works in the current release.

          The same concept would apply in an addon. The Window instance that is retrieved on line 80 would be replaced with the addons window that is passed in from the override.

          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment


            #6
            Jesse,

            This is great. I have everything I need to do exactly what I want, but I need two last pieces...

            1. How would I query the elements in the Chart Trader section to get the currently selected account and ATM strategy?

            2. How would I change the stop and limit prices of an ATM strategy either before they are placed or just after they are executed (i.e. after the stop trigger is activated)?


            The idea is that I can click my order button and have it execute my ATM strategy as soon as a particular bar closes but ONLY after I have armed the appropriate button.

            Adam

            Comment


              #7
              Hello,

              Thank you for the reply.

              Querying the current selector would likely prove to be difficult, I am unsure of a existing example of this.

              You can likely use the Addon sample to review the syntax used for creating an ATM selector. Using the knowledge from this example in contrast to the Indicator example, you may be able to work out a solution for this.

              Likely you would need to utilize the same approach as shown for finding the ChartTrader control by its automation id.

              Code:
              chartTrader = Window.GetWindow(ChartControl.Parent).FindFirst("ChartWindowChartTraderControl") as ChartTrader;
              To locate automation ID's, you can either inquire about the control in question to support or use the Inspect tool. The best I can do is provide a video showing the use of Microsofts tool Inspect.exe and the found ID. Unfortunately this is going pretty far beyond what we can document so if you will be using this tool, would need to explore some of this on your own terms. This tool is a general use tool for Windows and comes with Windows Software Development Kit (SDK) for Windows 8 which can be installed with Visual Studio.

              Inspect: https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx

              Use instructions: http://screencast.com/t/PGBXDOtztR

              The found ID for the selector was:
              ChartTraderControlATMStrategySelector
              Knowing the AutomationID, we can now form some syntax based on the found ChartTrader:

              Code:
              NinjaTrader.Gui.NinjaScript.AtmStrategy.AtmStrategySelector selector = chartTrader.FindFirst("ChartTraderControlATMStrategySelector") as NinjaTrader.Gui.NinjaScript.AtmStrategy.AtmStrategySelector;
              
              NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrategy(selector.SelectedAtmStrategy, entryOrder);
              I have omitted the entryOrder variable in this example, but this would locate the dropdown and cast to the correct type of control.


              Regarding changing the stop and limit, these can only be controlled by the ATM its self meaning whatever is set in the ATM's template. Unfortunately there is no way to modify these outside of this.

              To change these, you would likely need an array of templates to choose from based on logic, or if you are instead looking to do stop and target modifications by code, you may not want to utilize an ATM and instead create your own logic/user interface controls to accomplish that specifically.

              I look forward to being of further assistance.
              JesseNinjaTrader Customer Service

              Comment


                #8
                I think this should work - I'll let you know if I have any hiccups, but this should get everything done I need.

                On an unrelated note Jesse, my chart is still pausing... any progress with that on your end now that I've provided every file I have? I upgraded to .13 today. Same issue.

                Comment


                  #9
                  Hello,

                  I reviewed the prior items we have with your username on the forum and it appears we had tried to follow up by email regarding the chart pausing but did not get a response back. Potentially there was a missed message somewhere.

                  Could you send an email to platform support [at] ninjatrader [dot] com and we can resend the prior information to that email. Please include ticket number 1559448

                  I look forward to being of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment


                    #10
                    With regard to my colleague Jesse's advice earlier, I have prepared an add-on which exposes several ChartTrader fields as static members of an add-on that are refreshed to the active ChartTrader window.

                    This script was prepared for educational purposes and will not be maintained. In future versions of NinjaTrader, should a code change break this script, your first debugging step should be to follow Jesse's advice regarding the Inspect tool.
                    Attached Files
                    Jessica P.NinjaTrader Customer Service

                    Comment


                      #11
                      Hello Community,

                      Attached is an example of using the automation id to get the account selected in Chart Trader for a chart.

                      As well as a link to a code tidbit of getting the selected Atm Strategy.
                      https://ninjatrader.com/support/foru...365#post736365
                      Attached Files
                      Chelsea B.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by learningnt, Yesterday, 10:21 PM
                      0 responses
                      1 view
                      0 likes
                      Last Post learningnt  
                      Started by GMiller64, Yesterday, 01:13 PM
                      3 responses
                      9 views
                      0 likes
                      Last Post GMiller64  
                      Started by itrader46, Yesterday, 12:51 PM
                      5 responses
                      39 views
                      0 likes
                      Last Post rithikanth  
                      Started by hemlock, Yesterday, 11:45 AM
                      3 responses
                      14 views
                      0 likes
                      Last Post NinjaTrader_PatrickG  
                      Started by gbulle, Yesterday, 11:31 AM
                      3 responses
                      11 views
                      0 likes
                      Last Post bltdavid  
                      Working...
                      X