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 sjsj2732, Yesterday, 04:31 AM
            0 responses
            30 views
            0 likes
            Last Post sjsj2732  
            Started by NullPointStrategies, 03-13-2026, 05:17 AM
            0 responses
            286 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            282 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            132 views
            1 like
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            90 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Working...
            X