• 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

How I tell if a stop loss or profit target or my position is closed for an ATMStrateg

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

    How I tell if a stop loss or profit target or my position is closed for an ATMStrateg

    How I tell if a stop loss or profit target or my position is closed? when I'm using

    AtmStrategy _innerStrategy;

    lock (Account.All)
    account = Account.All.FirstOrDefault(a => a.Name == "Sim101");

    if (account != null)
    {
    entryOrder = account.CreateOrder(Instrument, OrderAction.Buy, OrderType.Market, OrderEntry.Automated, TimeInForce.Day, 1, 0, 0, string.Empty, "Entry", Core.Globals.Now.AddDays(1), new CustomOrder());
    _innerStrategy = AtmStrategy.StartAtmStrategy("AtmStrategyTemplate" , entryOrder);
    }

    I have a handle to the instance of teh AtmStrategy in my ninjascript.

    I'm using NT 8.


    Thanks,
    Tolu

    #2
    Hello Tolu,

    Thanks for your inquiry.

    It looks like you are inquiring about identifying when an Atm Strategy's target or stop loss was filled from a NinjaScript AddOn from NinjaTrader 8. However, you have bumped this thread in the NinjaTrader 7 forum. This is a very old historical thread that refers to NinjaTrader 6 as well.

    For organization purposes, and so other clients can better navigate the forums and find resolutions, please open a new thread in the appropriate forum in the future.

    From an AddOn, you may identify if an Atm strategy has been filled by subscribing to the OrderUpdate or ExecutionUpdate events and looking for information from the Order object in your OnOrderUpdate() method or the Order object of the Execution object in your OnExecutionUpdate() method.

    I have created a demonstration video showing how I have modified our AddOn Framework example to tell me information about the owner strategy of the Order object with Order.GetOwnerStrategy() This tells me:
    1. The order belongs to an AtmStrategy
    2. A unique ID for the AtmStrategy

    This information could then be used in your own logic to track the Atm strategies you create within your AddOn.

    Demo: https://www.screencast.com/t/ofdhascf0x2

    I've included links to our publicly available documentation on the items discussed and AddOn Framework example.

    Please note that the same approach may be taken within a NinjaScript Strategy, however you would use the built in OnOrderUpdate() and OnExecutionUpdate() methods as well as the ATM strategy methods for creation. In the context of a NinjaScript Strategy, I would suggest to create your own AtmStrategy ID's for monitoring the Atm strategy.

    You may refer to the SampleOnOrderUpdate Strategy and associated documentation for further direction in the context of a Strategy. I will also link the Atm Strategy methods documentation for use in the strategy.

    Please let me know if you have any questions.
    Last edited by NinjaTrader_Jim; 11-28-2017, 09:49 AM.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Trader17, Today, 04:07 PM
    0 responses
    1 view
    0 likes
    Last Post Trader17  
    Started by GussJ, Today, 01:30 PM
    4 responses
    12 views
    0 likes
    Last Post GussJ
    by GussJ
     
    Started by GARZONJ, Today, 12:25 PM
    3 responses
    15 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by RandanAL, Today, 11:53 AM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by yeshujbp, 07-21-2019, 02:40 PM
    2 responses
    36 views
    0 likes
    Last Post omololu
    by omololu
     
    Working...
    X