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 SalmaTrader, 07-07-2026, 10:26 PM
            0 responses
            47 views
            0 likes
            Last Post SalmaTrader  
            Started by CarlTrading, 07-05-2026, 01:16 PM
            0 responses
            22 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 06-17-2026, 10:32 AM
            0 responses
            15 views
            0 likes
            Last Post CaptainJack  
            Started by kinfxhk, 06-17-2026, 04:15 AM
            0 responses
            21 views
            0 likes
            Last Post kinfxhk
            by kinfxhk
             
            Started by kinfxhk, 06-17-2026, 04:06 AM
            0 responses
            23 views
            0 likes
            Last Post kinfxhk
            by kinfxhk
             
            Working...
            X