Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

managing stops and profit targets

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

    managing stops and profit targets

    I am trying to define IOrder objects to manage stop loss and profit target orders. The problem is, NT does not accept myShortProfitTargetOrder (below) since EntriesPerdirection equals 1 (as trace order says).
    How can i define profit target orders in that case?

    // variables......
    private IOrder myLongStopOrder = null;
    private IOrder myLongProfitTargetOrder = null;
    private IOrder myShortStopOrder = null;
    private IOrder myShortProfitTargetOrder = null;



    protected override void OnExecution(IExecution execution)
    {

    if (execution.Order != null && (execution.Name == "InRangeSYV"))
    {
    priceShort = execution.Price;
    myShortStopOrder = ExitShortStopLimit(0,true,positionTaken,((priceSho rt*(1+StopLevelMovel))+(1 * TickSize)),(priceShort*(1+StopLevelMovel)), "Stop loss short","InRangeSYV");
    myShortProfitTargetOrder = EnterLongLimit(positionTaken,(priceShort/(1+stopGainNumber)), "Profit target short");
    }

    #2
    Hello dafonseca,

    Thank you for your post.

    You are not being prevented due to EntriesPerDirection, you are being prevented from placing the order as it is an entry order to go long and yet you already have an exit order (the myShortStopOrder) that would be for the same direction (long to close the short).

    I suspect you meant to set the myShortProfitTargetOrder to ExitShortLimit() instead.
    However, if you intention is to reverse at the profit target you are not going to be able to do that with the ExitShortStopLimit() in place as well. You would need to wait for your limit price to be hit (instead of submitting a limit order) and then submit an ExitShort() and then an EnterLong().

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    61 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    148 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    98 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    286 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X