• 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

  • NinjaTrader_Jim
    replied
    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, 08:49 AM.

    Leave a comment:


  • 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

Latest Posts

Collapse

Topics Statistics Last Post
Started by ttodua, 12-06-2019, 11:40 PM
1 response
12 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by HiddenPhilosopher, Today, 06:45 AM
1 response
11 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by PG7940, Today, 04:26 AM
1 response
13 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by Sh00tHerMcGavin, Yesterday, 07:39 PM
1 response
10 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by dltharpe, Today, 09:17 AM
0 responses
7 views
0 likes
Last Post dltharpe  
Working...
X