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 algospoke, Yesterday, 06:40 PM
    2 responses
    23 views
    0 likes
    Last Post algospoke  
    Started by ghoul, Today, 06:02 PM
    3 responses
    14 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    45 views
    0 likes
    Last Post jeronymite  
    Started by Barry Milan, Yesterday, 10:35 PM
    7 responses
    21 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by AttiM, 02-14-2024, 05:20 PM
    10 responses
    181 views
    0 likes
    Last Post jeronymite  
    Working...
    X