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

Adjust TP & SL to average price?

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

    Adjust TP & SL to average price?

    Hello, when i enter a position with multiple entries my average price adjusts but the TP and SL stay where they were for the first entry.

    how do I set the ATM strategy to look at my average price for determining where my TP and SL should be placed?


    I think I was clear above but just in case here is an example of what I want:

    ATM= 25 tick target 25 tick stop

    entry 1 = 100. Target is 125 stop is 75

    entry 2 = 80. Average is now 90. Now my target should be adjusted to 115 and my stop should be adjusted to 65

    is there a setting to make this happen? Thanks

    #2
    Hello Douglee,

    Thank you for your post.

    Are you using an ATM strategy, or coding your own automated trading strategy?

    This would not be possible using an ATM strategy. If you are coding your own trading strategy, you could use Position.AveragePrice to adjust your stops and targets.



    Please let us know if you have any further questions.
    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the response. I’m not coding a strategy right now, but I guess if it’s only possible through coding I’ll have to do that.

      if I code the Strategy and everything is good I’m wondering if it will work for the way I trade.

      I make all my entries in the basic entries window. Will the strategy work if I enter there?

      I do this because for hot keys to work the instrument needs to be in focus but there is not way to hotkey a instrument to focus so I put all my instruments on tabs in the order entry window and I use stream deck macros to quickly shuffle through the tabs and execute the order on the correct instrument. I would do this with a chart but the problem is if you have multiple charts tabbed is tries to use the same atm for all instruments so I can’t do that.

      thanks!

      Comment


        #4
        Hello Douglee,

        Automated strategies make automated entries, so you wouldn't be doing manual entries through the basic entries window. The strategy would enter and exit automatically based on the logic of your code.

        If you are interested in coding your own strategy, I recommend taking a look at this support article on getting started with NinjaScript:

        Gaby V.NinjaTrader Customer Service

        Comment


          #5
          Oh okay, so what it’s called when all I want is the atm strategy to calculate take profit and stop loss from the average entry price instead of just the first entry price?

          Comment


            #6
            Hello Douglee,

            An ATM strategy cannot use Positon.AveragePrice. You can use Position.AveragePrice within a NinjaScript strategy by supplying the Position.AveragePrice to the value of your profit target or stop loss.

            This sample script demonstrates modifying the price of stop loss and profit target orders:



            AveragePrice - https://ninjatrader.com/support/help...erageprice.htm

            SetStopLoss - https://ninjatrader.com/support/help...etstoploss.htm

            ProfitTarget - https://ninjatrader.com/support/helpGuides/nt8/setprofittarget.htm


            You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services.


            Please let me know if you would like a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.​
            Gaby V.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Jonafare, 12-06-2012, 03:48 PM
            5 responses
            3,986 views
            0 likes
            Last Post rene69851  
            Started by Fitspressorest, Today, 01:38 PM
            0 responses
            2 views
            0 likes
            Last Post Fitspressorest  
            Started by Jonker, Today, 01:19 PM
            0 responses
            2 views
            0 likes
            Last Post Jonker
            by Jonker
             
            Started by futtrader, Today, 01:16 PM
            0 responses
            8 views
            0 likes
            Last Post futtrader  
            Started by Segwin, 05-07-2018, 02:15 PM
            14 responses
            1,792 views
            0 likes
            Last Post aligator  
            Working...
            X