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.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by murjsuhes, Today, 08:13 AM
    0 responses
    2 views
    0 likes
    Last Post murjsuhes  
    Started by krpkevin, Today, 07:50 AM
    0 responses
    4 views
    0 likes
    Last Post krpkevin  
    Started by robforee2, Yesterday, 06:11 PM
    2 responses
    16 views
    1 like
    Last Post NinjaTrader_ChrisL  
    Started by minds2010, Today, 03:38 AM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by DTSSTS, Yesterday, 07:11 PM
    2 responses
    32 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X