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

1 Minute Swing Scalp in Strategy Builder

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

    1 Minute Swing Scalp in Strategy Builder

    I am using Strategy Builder to try and construct a simple 1 point scalp on the 1 minute chart with an optional scale-in on an 8 tick adverse move. I have attached the strategy. I wanted to filter out swings which have a range of <= 7 ticks. I tried to do this using an offset of the swing indicator high vs. low, image attached.

    Apparently Condition Builder had an issue with this, because the strategy would not run until I removed this condition. Is there any way I can define a range, from high to low, in such a way? I would like to have enough room to resistance to have a reasonable chance to get at least 4 ticks.

    Thanks. 1MinSwingScalpLong.zip
    ​​​​​​​

    #2
    Hello Bionian,

    Thank you for your post.

    I've added this setup to the strategy, and it runs for me, just doesn't often take trades - I ran this on a 1 year 60 minute NQ chart and it only took 585 trades over the entire year. Is it disabling itself when you add the strategy to the chart, or do you just not see trades being taken? What instrument and interval chart are you trying it with?

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your reply. When I tried to run the strategy on the chart (NOT on the strategy tab on the control center, but the actual 1 min chart), and checked enable, I got no signals, at least that I could see. Perhaps the way I constructed it, I accidentally made it too restrictive. This is intended to be a 1 minute strategy for tight trading ranges- 4 to 6 or 8 points, to scalp long for 1 point at the bottom, and sell at the top for a 1 point scalp. Then on a 2 point adverse move, there would be a second entry to scale into the losing position. Trading range breakouts usually fail, so any breakout could be bought, mimicking a limit order. The reason for restricting the range to 7 ticks or more it to filter out trades which have too much close overhead supply. Perhaps what I created was in error.

      However, this 7-tick restriction may not even be necessary as long as the strategy will automatically reverse and enter in the opposite direction on an opposite signal. There would probably be at least enough room to get a 1-2 tick scratch.

      It seems that the strategies I have created so far automatically reverse positions on a valid signal in the opposite direction. How can I set up the strategy in Strategy Builder to make sure this happens? Then the range may not be important anyway.

      Thanks-
      Rick

      Comment


        #4
        Hello Rick,

        Thank you for your reply.

        Might have just been the instrument you tried it on. I've got it running right now on a 1 minute ES 12-19 chart and from the 7th through today I see 94 trades.

        When calling an entry method in the opposite direction of your current position this will cause your position to be reversed. NinjaTrader will automatically submit an order to close your existing position and then enter an order to enter you into the opposite position.

        Note, though, if you call an exit method (like ExitShort, stops and targets don't count for this) and call an entry method in the same run of OnBarUpdate, which occurs once per bar, the OnPositionUpdate() method will not have yet run and NinjaTrader will not have known that your position is closed.

        This will cause both actions to complete and end up sending 3 orders. The first order is the exit position from your exit method, the second order is to close the position from NinjaTrader automatically reversing your position, the third order is to enter you into the opposite position.

        The result is that either the script will double the quantity when it reverses or it will cause an overfill and stop the script.

        From the help guide:

        "Entry() methods will reverse the position automatically. For example if you are in a 1 contract long position and now call EnterShort() -> you will see 2 executions, one to close the prior long position and the other to get you into the desired 1 contract short position."



        So, just make sure you aren't using Exit methods along with the entry and you're good.

        I'm about to review your email from yesterday, so I'll reply back to that through the ticketing system.

        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Kate,

          I'm not sure I understand, but yesterday I was getting unexpected orders on this different strategy. Could that be what was going on? ReversalWStochLongShortAutoTrading.zip

          Comment


            #6
            Hello Rick,

            Thanks for your reply.

            That wouldn't be the case with this latest strategy - you're not using Exit orders in this one, just entries. I think what you're running into is possibly calling EnterLong or EnterShort twice causing unexpected behavior, but it could very well have to do with trying to submit orders with a quantity of 0; I'd need to do some testing. Have you tried turning on Trace Orders to see what's being submitted or ignored or rejected?

            Strategy Builder > Default Properties > More Properties > Trace Orders

            Once you then recompile the strategy, you can open a new NinjaScript Output window under New > NinjaScript Output. This will print a log of any orders submitted by the strategy during while it's running, along with any ignored orders. You can then look through and see what may be occurring.

            Here is a link to our help guide that goes into more detail on tracing orders:



            If you are unsure what the order trace tells you, I'd be happy to take a look at what you get.

            Please let us know if we may be of further assistance to you.
            Kate W.NinjaTrader Customer Service

            Comment


              #7
              Actually, this strategy should have exit orders, both stop loss and profit targets. See attachment. There are 2 long positions and 2 short positions, each with a stop-loss and profit target. 8 total exits.

              Click image for larger version  Name:	Reversal strategy stops and targets.PNG Views:	0 Size:	29.2 KB ID:	1080824
              Attached Files

              Comment


                #8
                Hi Rick,

                Thank you for your reply.

                Those would be what we'd refer to as "Set" orders. They're a little different from an exit, as they're specifically profit targets. When I say Exit orders, I mean what you'd see in the Actions section of the builder, like "Exit Long" and "Exit Long LImit".

                Please let us know if we may be of further assistance to you.
                Kate W.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_Kate View Post
                  Note, though, if you call an exit method (like ExitShort, stops and targets don't count for this) and call an entry method in the same run of OnBarUpdate, which occurs once per bar, the OnPositionUpdate() method will not have yet run and NinjaTrader will not have known that your position is closed.
                  I get these crashes all the time.
                  Hoping that bars since exit > 0 can fix it
                  edit: nope didnt
                  Last edited by ezrollin; 12-05-2021, 12:57 AM.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by aa731, Today, 02:54 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post aa731
                  by aa731
                   
                  Started by thanajo, 05-04-2021, 02:11 AM
                  3 responses
                  469 views
                  0 likes
                  Last Post tradingnasdaqprueba  
                  Started by Christopher_R, Today, 12:29 AM
                  0 responses
                  10 views
                  0 likes
                  Last Post Christopher_R  
                  Started by sidlercom80, 10-28-2023, 08:49 AM
                  166 responses
                  2,237 views
                  0 likes
                  Last Post sidlercom80  
                  Started by thread, Yesterday, 11:58 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post thread
                  by thread
                   
                  Working...
                  X