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 CarpetHooligan, Yesterday, 05:49 PM
    0 responses
    15 views
    0 likes
    Last Post CarpetHooligan  
    Started by EquityTrader, Yesterday, 03:33 PM
    0 responses
    14 views
    0 likes
    Last Post EquityTrader  
    Started by ahelton, Yesterday, 11:53 AM
    2 responses
    41 views
    0 likes
    Last Post ahelton
    by ahelton
     
    Started by tonynt, Yesterday, 02:07 PM
    0 responses
    22 views
    0 likes
    Last Post tonynt
    by tonynt
     
    Started by sgordet, Yesterday, 01:57 PM
    0 responses
    20 views
    0 likes
    Last Post sgordet
    by sgordet
     
    Working...
    X