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