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

Applying the current active ATM strategy to new orders (not template)

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

    Applying the current active ATM strategy to new orders (not template)

    Hi - Chart Trader buttons have a feature that whenever a new order is placed then the ATM strategy stop and targets that are applied to each new order are the same as that of the currently active ATM strategy for the active position. Please see the attached GIF to demonstrate what I am referring to. This is really helpful as it allows managing the full position. Please can you help me direct me toward the code which will help me select the active ATM strategy for the existing position?


    I am trying to do the same for an indicator I am programming. It has chart buttons to submit new order and it uses the following code to apply the selected ATM strategy template to each new order. However, this creates multiple stops and targets for each new order unlike the Chart Trader method demonstrated in GIF.

    My code below

    Code:
    NinjaTrader.Gui.NinjaScript.AtmStrategy.AtmStrategySelector atmSelector = (Window.GetWindow(ChartControl.Parent).FindFirst(" ChartTraderControlATMStrategySelector") as NinjaTrader.Gui.NinjaScript.AtmStrategy.AtmStrategySelector);
    
    myOrder = account.CreateOrder(Instrument, OrderAction.Buy, OrderType.Limit, OrderEntry.Manual, TimeInForce.Gtc, myQuantity, Math.Min(Low[1], GetCurrentBid() - 1 * TickSize), 0, string.Empty, "Entry", DateTime.MaxValue, null);
    
    if (atmSelector.SelectedAtmStrategy != null)
    
    {
    NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrategy(atmSelector.SelectedAtmStrategy, myOrder);
    }
    Attached Files
    Last edited by samanruptrader; 08-02-2023, 11:11 AM.

    #2
    Hello samanruptrader,

    Unfortunately, there is not a method to scale into an existing Atm.

    A request for this feature was submitted, tracked with ID # SFT-2522, and I will be happy to add your vote to that request.

    In the meantime, you could submit the entry, and then modify the quantity of the stop and target with <Account>.Change().


    This example below may provide some ideas on how to find orders by the atm strategy.
    This indicator serves to provide labels for Atm strategies that are present on your chart. Each new Atm strategy will rotate through the colors defined in your Brush Collection. Simply add to a chart, select the data series you want to have labels added to, choose your font and add all the brushes/colors you want [&#8230;]
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Option Whisperer, Today, 09:55 AM
    1 response
    11 views
    0 likes
    Last Post bltdavid  
    Started by port119, Today, 02:43 PM
    0 responses
    1 view
    0 likes
    Last Post port119
    by port119
     
    Started by Philippe56140, Today, 02:35 PM
    0 responses
    3 views
    0 likes
    Last Post Philippe56140  
    Started by 00nevest, Today, 02:27 PM
    0 responses
    2 views
    0 likes
    Last Post 00nevest  
    Started by Jonafare, 12-06-2012, 03:48 PM
    5 responses
    3,986 views
    0 likes
    Last Post rene69851  
    Working...
    X