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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X