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

From within an Indicator, detect any orders submitted manually or by a strategy

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

    From within an Indicator, detect any orders submitted manually or by a strategy

    From within an indicator, I want to detect when an order has been entered/filled/exited. The orders can be submitted from a strategy or manually, but not from the indicator itself.

    I want to detect and track the progress of the orders to completion purely from the indicator. I know it is possible to reference the Strategy namespace in an indicator to access constructs within a strategy, but orders may be submitted manually too, so relying on a strategy is not suitable.

    Any thoughts?

    Thanks.
    Multi-Dimensional Managed Trading
    jeronymite
    NinjaTrader Ecosystem Vendor - Mizpah Software

    #2
    Hello,

    Thank you for the question.

    There is not a documented way to do what you are looking for. I would like to provide a sample script that should get you going in the direction you want to.

    I would like to note that this is undocumented code and is not supported; therefore any questions pertaining to this script may or may not be answered by support.

    What this script does is the following process:
    • OnStartUp:The indicator loops through the available accounts and gets the specified account set in the variables.
    • If the account is found, it attaches Execution, OrderStatus, PositionUpdate, and ConnectionStatus handlers to the account.
    • If there is an event that happens, one of the handlers that was attached will catch the event
    • OnTermination: loops through the accounts again and finds the specified account - then removes the handlers so that when the chart is closed or the indicator is removed the actions can no longer happen.


    This should give you the information you need to get the account position and other information in an indicator.

    I should also note that this is set up to print the status's to the Output window (Tools -> Output Window)

    Please let me know if I may be of additional assistance.
    Attached Files
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by bmartz, 03-12-2024, 06:12 AM
    4 responses
    32 views
    0 likes
    Last Post bmartz
    by bmartz
     
    Started by Aviram Y, Today, 05:29 AM
    4 responses
    12 views
    0 likes
    Last Post Aviram Y  
    Started by algospoke, 04-17-2024, 06:40 PM
    3 responses
    28 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by gentlebenthebear, Today, 01:30 AM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by cls71, Today, 04:45 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X