Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

stop limit question

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

    stop limit question

    Under xp, beta .8

    Running a strategy in simulation, using enterlongstoplimit and getting the following error:

    Limit price can't be smaller than stop price. Affected Order: Buy 1 StopLimit @ 12519 x 12513
    Is this correct? I don't get this error when running a strategy on a live account, only on sim accounts.

    This is a breakout strategy, with a stop at the high of the past few bars, then attempting to buy a few ticks below that.

    this is what I'm using to enter the order:

    EnterLongStopLimit((Highs[0][Bars.HighestBar(entryBars)]-6),Highs[0][Bars.HighestBar(entryBars)],"LongLimit");
    Also, the documentation is a little off:



    limitPrice The limit price of the order.
    stopPrice The limit price of the order.


    Is it not possible to set the limit below the stop, or is this a bug?

    -Erik

    #2
    It is not possible to submit a limit price below the stop price for a buy stop limit order. This is invalid order according to any exchange. Manually this is supported since it uses our Simulated Stop technology but this has not been extended to NinjaScript.
    RayNinjaTrader Customer Service

    Comment


      #3
      Wierd, I've been doing this all week on a live IB account, and a live MBT account, and it DOES work. You can see below I have a stop at 12508, and a limit at 12502 and it gets executed.

      See below:

      Execution='YM 03-08/0000ee43.47b252d4.01.01' Instrument='YM 03-08' Account='U438881' Exchange=ECbot Price=12502 Quantity=1 Market position=Long Operation=Insert Order='1975693572' Time='2/13/2008 11:15:25 AM'

      Order='1957693572/U438881' Name='LongLimit' New State=Filled Instrument='YM 03-08' Action=Buy Limit price=12502 Stop price=12508 Quantity=1 Type=StopLimit Filled=1 Fill price=12502 Error=NoError Native error=''

      Order='1957693572/U438881' Name='LongLimit' New State=Working Instrument='YM 03-08' Action=Buy Limit price=12502 Stop price=12508 Quantity=1 Type=StopLimit Filled=0 Fill price=0 Error=NoError Native error=''

      Order='1957693572/U438881' Name='LongLimit' New State=Accepted Instrument='YM 03-08' Action=Buy Limit price=12502 Stop price=12508 Quantity=1 Type=StopLimit Filled=0 Fill price=0 Error=NoError Native error=''

      Order='1957693572/U438881' Name='LongLimit' New State=PendingChange Instrument='YM 03-08' Action=Buy Limit price=12502 Stop price=12508 Quantity=1 Type=StopLimit Filled=0 Fill price=0 Error=NoError Native error=''
      I must be misunderstanding something. Is it possible that both MBT and IB are handling this on their end and the stoplimitorder is not getting sent to the exchange the way I'm sending it? Like they are handling the it internally and just sending a limit when the stop gets executed?

      -Erik
      Last edited by woodside; 02-13-2008, 03:05 PM.

      Comment


        #4
        Interesting...IB then simulates that as we do with our simulated stops. This is an invalid order at the exchange and that is what we simulate in our simulation engine.
        RayNinjaTrader Customer Service

        Comment


          #5
          Okay, that makes sense. It works in backtesting, no errors, but when I try to run it live on a sim account it throws that error.

          Thanks.

          -Erik

          Comment


            #6
            Erick, I was wondering if you have been able to continue to run these simulated stops at IB without any major problems?

            In a recently ( http://www.ninjatrader-support2.com/...5002#post85002 ) I also noted that the code worked fine in backtest & optimization modes, but I couldn't get it work in Replay mode and didn't want to risk money when NT and customer support was telling me simulated orders like this wouldn't work.

            I was/am still pretty confused by this. Any thoughts, items I should be careful about, or suggestions that you could share using simulated stops would be greatly appreciated. I use IB also and am relatively new to NinjaScript.

            Thanks,

            Rob.

            Comment


              #7
              Rob,

              This thread would elude to this type of simulation being simulated on IB some how. As far as experience in live running of these types I will leave that to woodside to respond.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Thanks Josh, I understand its not a supported function of NT. I just found it curious that NT allows this type of order in backtesting & optimizing, and then was a little frustrate at first that (as I presently understand it) that NT wouldn't support these negative simulated orders in replay & in live trading. The frustration arose from having though backtesting I had programmed NT to do what I wanted, but then found out it might not work, & I'd have to program it a different way. Maybe in a future edition will support these types of orders.

                But in the long run it is helping me learn a little more about programing in NinjaScript and expand/clarify my knowledge of stops. Thus I'm looking over anything I can find out about this now.

                Thanks again, Rob.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by cmtjoancolmenero, Yesterday, 03:58 PM
                4 responses
                23 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by Brevo, Today, 01:45 AM
                1 response
                14 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by rjbtrade1, 11-30-2023, 04:38 PM
                2 responses
                74 views
                0 likes
                Last Post DavidHP
                by DavidHP
                 
                Started by suroot, 04-10-2017, 02:18 AM
                5 responses
                3,021 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by Stanfillirenfro, Today, 07:23 AM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Working...
                X