Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

resetting stop resulting in order errors

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

    resetting stop resulting in order errors

    I'm using NT8 Ninjascript. When I reset my stop I receive order errors and I'm pretty sure I don't have a stop any more. (I'm verifying that.)

    This is essentially what I'm doing.

    When I decide to enter a market short order, I do:

    int SStopLoss=10;
    EnterShort(DefaultQuantity, "");
    SetStopLoss("", CalculationMode.Ticks, SStopLoss, false);

    Then on a bar update, I may reset the stop like this:

    double newStop=40.00
    SetStopLoss(CalculationMode.Price,newStop);

    Also, on a bar update, I may decide to exit the order, like this:

    ExitShort();
    SetStopLoss("", CalculationMode.Ticks, SStopLoss, false);

    I do the SetStopLoss because I read somewhere that I need to do that for the next order.

    Any suggestions or pointers would be appreciated.

    Craig.

    #2
    Hello therealoracle,

    Calling ExitShort without arguments renders your position flat. A stop loss order is automatically cancelled if the managing position is closed by another strategy generated exit order. This is exactly the situation you have created. Your reset of the stop loss that you are already performing at the beginning of OnBarUpdate is sufficient. Your final SetStopLoss is unnecessary.

    I am providing Help Guide reference pages for SetStopLoss and ExitShort.


    Jessica P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by claxxical, 05-30-2017, 12:30 PM
    37 responses
    4,452 views
    0 likes
    Last Post Padan
    by Padan
     
    Started by SugarDefwebsite, Today, 02:18 AM
    0 responses
    3 views
    0 likes
    Last Post SugarDefwebsite  
    Started by usglucofreeze, Today, 01:19 AM
    0 responses
    7 views
    0 likes
    Last Post usglucofreeze  
    Started by f.saeidi, Today, 01:12 AM
    0 responses
    10 views
    0 likes
    Last Post f.saeidi  
    Started by NinjaTrader_ChelseaB, 03-14-2017, 10:17 AM
    227 responses
    34,319 views
    7 likes
    Last Post rare312
    by rare312
     
    Working...
    X