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

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, 09: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 Christopher_R, Today, 12:29 AM
0 responses
4 views
0 likes
Last Post Christopher_R  
Started by sidlercom80, 10-28-2023, 08:49 AM
166 responses
2,234 views
0 likes
Last Post sidlercom80  
Started by thread, Yesterday, 11:58 PM
0 responses
1 view
0 likes
Last Post thread
by thread
 
Started by jclose, Yesterday, 09:37 PM
0 responses
7 views
0 likes
Last Post jclose
by jclose
 
Started by WeyldFalcon, 08-07-2020, 06:13 AM
10 responses
1,414 views
0 likes
Last Post Traderontheroad  
Working...
X