Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Working with existing orders.

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

    Working with existing orders.

    Hi,
    To help better understand my strategy and to optimize it, I'd like to do a few things after a trade is placed.
    1. I'd like to draw vertical lines from the trade entry point to the TP/SL points on the chart. I've interrogated the order object and the position object in Visual Studio and can't find anything resembling those points. The "Draw.Line" method looks suitable, but again I can't find the targets from the order or position objects. I know I can store them in a global variables, but this is a learning exercise for me and I hate global variables.
    2. I'd like to perform partial close events at certain points. F.E. If the trade moves in my favor 80% of the target price, I'd like to close 50% of the position and move the stop loss a few pips above the entry price.

    #2
    Hello Herrwolf1,

    We have a sample that demonstrates monitoring the targets in the following link: https://ninjatrader.com/support/help..._and_profi.htm

    You could use that approach to do the drawing from OnExecutionUpdate or OnOrderUpdate depending on the event you wanted to gather. The entry point could be found using OnExecutionUpdate and getting the executions average fill price. The targets can be found using OnOrderUpdate by their name. You can also use the overrides to store the orders as variables so you can use OnBarUpdate for drawing.

    For your second question we have a sample of a break even here: https://ninjatrader.com/support/help...and_onexec.htm

    You could use that type of logic to do a partial close as well. You would need to enter with two separate entries if you plan to scale out, there is a sample of scaling out here: https://ninjatrader.com/support/help...a_position.htm

    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    59 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    134 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    74 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X