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

Is there a way to track and reference entry prices within a strategy?

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

    Is there a way to track and reference entry prices within a strategy?

    Here's an example of what I'm trying to accomplish within an NT7 strategy:

    Let's say the strategy opens a long position... like a market order to buy 1 NQ contract at $11,850.25. Minutes later, that position hits the stop loss price and is closed out. How can I reference that losing trade so I can code my strategy to not take long trades around that same price area?

    How can I "save" and reference the (CalculationMode.Price, Position.AvgPrice) of losing trades so my strategy can look at them later and include that data in the logic that determines if a position should be opened? Determining the price area to avoid isn't my question, but what I can't figure out os how to get the strategy to look back at prior trades entry prices.

    If it matters, I'm using the managed order entry approach and would prefer not to use unmanaged if at all possible.

    Thanks in advance for any help or code samples.​

    #2
    Hi fredb987, thanks for posting. You can use the OnExecutionUpdate event to track every entry and exit that happens within the strategy. Typically, entries and exits are identified by their signal names which you create when calling an entry order.

    Here are some examples that demonstrate this well:



    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by fx.practic, 10-15-2013, 12:53 AM
    5 responses
    5,406 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by Shai Samuel, 07-02-2022, 02:46 PM
    4 responses
    98 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by DJ888, Yesterday, 10:57 PM
    0 responses
    8 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by MacDad, 02-25-2024, 11:48 PM
    7 responses
    160 views
    0 likes
    Last Post loganjarosz123  
    Started by Belfortbucks, Yesterday, 09:29 PM
    0 responses
    9 views
    0 likes
    Last Post Belfortbucks  
    Working...
    X