• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 rafaelabe1977, Today, 03:51 AM
    1 response
    8 views
    0 likes
    Last Post sledge
    by sledge
     
    Started by inghkip17, Today, 06:25 AM
    0 responses
    4 views
    0 likes
    Last Post inghkip17  
    Started by inghkip17, Today, 06:23 AM
    0 responses
    4 views
    0 likes
    Last Post inghkip17  
    Started by xbdjvhbfvn, Today, 05:20 AM
    0 responses
    5 views
    0 likes
    Last Post xbdjvhbfvn  
    Started by jenifeery79, Today, 05:03 AM
    0 responses
    4 views
    0 likes
    Last Post jenifeery79  
    Working...
    X