Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Auto stop limit

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

    Auto stop limit

    I am trying to make the stops be put in a tick above/below the previous candle which the buy/sell was initiated.

    For a sell signal: EnterLongLimit(DefaultQuantity, Open[1] + 1 * TickSize, "a");
    For a buy signal: EnterShortLimit(DefaultQuantity, Open[1] + 1 * TickSize, "b");

    For some reason it doesn't seem to be working. I put this just below the buy sell order quantity line

    #2
    Hi brucelevy, perhaps I'm not following 100% what you want to do, however you're not trying to place exit stops here in your code but Enter limit orders? You also reference the past bar Open values, whereas for a long stop usually the last bar low - Ticksize would be used and vice versa for stops.

    Comment


      #3
      Yes I would like to have my stop placed a tick below the previous candles low for a long entry

      Comment


        #4
        Hello brucelevy,

        Thank you for your response.

        Is the following what you were looking for?
        Code:
        			if(Close[0] < Low[1] - 1*TickSize)
        				EnterLongStop(DefaultQuantity, Low[1]-1*TickSize, "a");

        Comment


          #5
          Would that go in this area?
          {
          EnterLong(DefaultQuantity, "b");
          IsLongOk = false;
          IsShortOk = true;
          }
          Last edited by brucelevy; 02-13-2015, 01:18 PM.

          Comment


            #6
            Yes, as long as it was after your EnterLong in the same conditional block. However, If you're trying to set a stop loss order after your EnterLong executes, you would then need to use ExitLongStop().

            In that case, the if(Close[0] < Low[1] - 1*TickSize) in Patrick's example wouldn't needed.

            Code:
            {
            EnterLong(DefaultQuantity, "b");
            ExitLongStop(DefaultQuantity, Low[1]-1*TickSize, "a");
            
            IsLongOk = false;
            IsShortOk = true;
            }
            MatthewNinjaTrader Product Management

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by charlesugo_1, 05-26-2026, 05:03 PM
            0 responses
            67 views
            0 likes
            Last Post charlesugo_1  
            Started by DannyP96, 05-18-2026, 02:38 PM
            1 response
            150 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 05-11-2026, 05:56 AM
            0 responses
            162 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 05-10-2026, 08:12 PM
            0 responses
            99 views
            0 likes
            Last Post CarlTrading  
            Started by Hwop38, 05-04-2026, 07:02 PM
            0 responses
            287 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Working...
            X