Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy stop loss

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

    Strategy stop loss

    hello
    i have a strategy of stop loss of 1.5 atr. in the code below i get error
    10/12/2008 5:53:28 AM Order Sell stop or sell stop limit orders can't be placed above the market. Affected Order: Sell 9962 Stop @ 1.0747
    the runtime ATR value is .0038.



    10/12/2008 5:53:29 AM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='ZLR' Mode=Ticks Value=0.00380578851165889 Currency=0 Simulated=False
    need to implement logicATR value 0.00380578851165889
    10/12/2008 5:53:29 AM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='ZLR' Mode=Ticks Value=0.00380578851165889 Currency=0 Simulated=False
    10/12/2008 5:53:29 AM CancelAllOrders: BarsInProgress=0

    Code:
    [FONT=Courier New][SIZE=2][COLOR=#0000ff]
    private[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] setupStops(){
    
    
    Print([/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]"need to implement logic"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] + [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]"ATR value "[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] + ATRValue);
    SetStopLoss(SIGNALZLR,CalculationMode.Ticks,ATRValue,[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]);
    
    [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000]//entryOrder.
    [/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]}
    [/SIZE][/FONT]
    why is this code not firing a top which is .0038 away from my entry price

    #2
    Hi junkone,

    Please check out this reference sample dealing with StopLoss and ProfitTarget modifications - http://www.ninjatrader-support2.com/...ead.php?t=3222

    Also the SetStopLoss() expects the offset to be entered in ticks (with CalculationMode.Ticks), so please make sure this works out to the stoplevel you expected.

    Comment


      #3
      i have read it quite a bit and need more clarity.
      the instrument in this case if AUDUSD and its tick value if .0001
      and a buy price of 1.0747. am trying to set a stop loss of .0036 from my purchase price and to be expressed in ticks.
      so should the function call read
      SetStopLoss(SIGNALZLR,CalculationMode.Ticks,36 ,false);
      or should it read
      SetStopLoss(SIGNALZLR,CalculationMode.Ticks,.0036 ,false);

      Comment


        #4
        The first one with 36.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          how to cancel the stop loss

          how do i cancel the stop loss order?

          Comment


            #6
            Hi junkone,

            The StopLoss order will be automatically cancelled if the position is closed by another order.

            You can also look into the CancelOrder() method - http://www.ninjatrader-support.com/H...ncelOrder.html

            Comment


              #7
              To clarify, you cannot explicitly cancel an order submitted by a Set() method. If you managed your own stop loss order through the use of ExitLongStop() or ExitShortStop() you can use CancelOrder() to cancel that order.
              Josh P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by charlesugo_1, 05-26-2026, 05:03 PM
              0 responses
              60 views
              0 likes
              Last Post charlesugo_1  
              Started by DannyP96, 05-18-2026, 02:38 PM
              1 response
              145 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by CarlTrading, 05-11-2026, 05:56 AM
              0 responses
              161 views
              0 likes
              Last Post CarlTrading  
              Started by CarlTrading, 05-10-2026, 08:12 PM
              0 responses
              97 views
              0 likes
              Last Post CarlTrading  
              Started by Hwop38, 05-04-2026, 07:02 PM
              0 responses
              283 views
              0 likes
              Last Post Hwop38
              by Hwop38
               
              Working...
              X