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