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

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 junkone, Today, 11:37 AM
    0 responses
    2 views
    0 likes
    Last Post junkone
    by junkone
     
    Started by quantismo, 04-17-2024, 05:13 PM
    5 responses
    34 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by proptrade13, Today, 11:06 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by love2code2trade, 04-17-2024, 01:45 PM
    4 responses
    34 views
    0 likes
    Last Post love2code2trade  
    Started by cls71, Today, 04:45 AM
    2 responses
    10 views
    0 likes
    Last Post eDanny
    by eDanny
     
    Working...
    X