Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Where to start if I want to create a strategy on a trading set-up?

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

    Yes Matthew. I have Trace Orders True for my strategy. I went through the log and it does not have remarks for my strategy on the ES chart. Guess because it has not triggered any trades (even it should have done when price broke up).

    For the strategy on the 6E chart, it did have the OrderRejected and Strategy cancelled messages captured on the log.

    Appreciate any tips for my trouble-shooting. Thank you.

    Beth

    Comment


      Beth,

      I see you have a lot of debugging information in your code already. When the condition set was true, did you get the Entering LongStop/ShortStop" printed to the output window? Did the DrawText display? Or was this missed as well?

      Are you sure there were not any messages saying that it was ignoring an entry order?
      MatthewNinjaTrader Product Management

      Comment


        Hi Matthew

        My strategy worked when it's on a 6E 1-minute chart this morning. It has triggered a text stating the entry points on the chart upon completing the specified breakout timeline, had the required stop orders on the Control Center, cancelled the pending orders when it's filled.

        It has not triggered anything on the ES 1-minute chart - strange that it works on one instrument and not the other.

        I will work on fixing the OrderRejected error since my strategy on the 6E chart tried to enter again after completing a trade. Then explore why it's not working on ES.

        Will you please enlighten me how can I specify my stop order "1 tick above/below" the predetermined HH/LL of the breakout range and not # of ticks? Have not done that before. Thank you.

        Continue enjoying your day.

        Beth

        Comment


          Hello

          I did a quick market replay. It did not trigger a trade when price broke the breakout point. No text and orders though the chart continued plotting. Then it stopped plotting at 12:00 midnight. You can tell from the following short clip that the timer on the Replay continued running while Bid/Ask window on the Control Center has stopped:

          World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


          Appreciate any tips to resolve the issues. Thank you very much.

          Beth

          Comment


            Hello,

            Originally posted by belecona View Post
            Will you please enlighten me how can I specify my stop order "1 tick above/below" the predetermined HH/LL of the breakout range and not # of ticks? Have not done that before.
            //this would enter a long stop order 1 tick above the high of the current bar
            entryOrder = EnterLongStop(High[0]+ 1*TICKSIZE, "myLong");



            Additionally you may find this a good example for using IOrder: http://www.ninjatrader.com/support/f...ead.php?t=7499

            I did a quick market replay. It did not trigger a trade when price broke the breakout point. No text and orders though the chart continued plotting. Then it stopped plotting at 12:00 midnight. You can tell from the following short clip that the timer on the Replay continued running while Bid/Ask window on the Control Center has stopped:
            Please ensure you have the level 2 (for the bid/ask data) and level 1 data available for this time. Right click the Repay controller -> available data...

            If it's not there you will need to download it by going to utilities -> download replay data

            Please let me know if I can be of further assistance.
            LanceNinjaTrader Customer Service

            Comment


              Hi Lance

              Thanks for your suggestion. Currently, my entry stop orders work well (I've specified 1 tick above/below the breakout range). I have a pending stop order @12 ticks from entry. I would like to change it to 1 tick above/below the breakout range. Appreciate your providing me with a sample if available or give me some tips. Thanks.

              Beth

              Comment


                Hello,

                You could use

                stopOrder = ExitLongStop(BREAKOUTRANGEHIGH+ 1*TICKSIZE, "myLong");


                Where BREAKOUTRANGEHIGH is your custom range's high value.
                LanceNinjaTrader Customer Service

                Comment


                  Hi Lance

                  I removed my former "SetStopLoss("", CalculationMode.Ticks, stoplossticks, false);" codes and added the following:

                  private double StopOrder = 0;

                  protected override void OnBarUpdate()

                  //Condition set 1 Go Long
                  EnterLongStop(DefaultQuantity, highestHigh+TickSize,"");
                  StopOrder = (lowestLow-TickSize);

                  //Exit Condition 1: Stop Order 1 tick below LL

                  ExitLongStop(StopOrder);
                  Compiled the revised strategy successfully. Do you notice anything wrong please? Thank you.

                  Beth

                  Comment


                    Oh .. one question please. Should I have 2 different StopOrders (say StopOrder 1 and StopOrder2) for my LongStop and ShortStop exit orders? Thank you.

                    Beth

                    Comment


                      Hello,

                      Oh .. one question please. Should I have 2 different StopOrders (say StopOrder 1 and StopOrder2) for my LongStop and ShortStop exit orders? Thank you.
                      While not required this would be a good idea as it would allow you to individually manage them.

                      There isn't anything "wrong" with the code, but you may notice your orders may not be managed as you expect.

                      I strongly recommend using the following as a starting template for structuring your order handling: http://www.ninjatrader.com/support/f...ead.php?t=7499


                      If this is too advanced for you, you can still use SetStopLoss(), this does have some limitations which are discussed here: http://www.ninjatrader.com/support/h...etstoploss.htm
                      SetStopLoss("myLong", CalculationMode.Price, BREAKOUTRANGEHIGH+ 1*TICKSIZE , false);


                      Please let me know if I can be of further assistance.
                      Last edited by NinjaTrader_Lance; 12-18-2012, 12:34 PM.
                      LanceNinjaTrader Customer Service

                      Comment


                        Hi Lance

                        I am unable to comply my strategy successfully once I added the following (Error message: SetStopOrder1/SetStopOrder2 do not exist in the current context):

                        protected override void Initialize()
                        SetStopOrder1("",CalculationMode.Price,lowestLow-1*TickSize, false);
                        SetStopOrder2("",CalculationMode.Price,highestHigh +1*TickSize, false);

                        portected override void OnBarUpdate()
                        SetStopOrder1("", CalculationMode.Price, lowestLow-1*TICKSIZE , false);
                        SetStopOrder2("",CalculationMode.Price,highestHigh +1*TickSize, false);
                        I estimate that I must have missed something and not sure what? Is it fine to stay with the following simple version:
                        EnterLongStop(DefaultQuantity, highestHigh+TickSize,"");
                        StopOrder1 = (lowestLow-TickSize);


                        //Exit Condition 1: Stop Order 1 tick below LL
                        ExitLongStop(StopOrder1);
                        You're right that the iOrder script is too advanced for me.

                        Thank you.

                        Beth

                        Comment


                          Hello,

                          If IOrder is to advanced, I would recommend starting with creating one strategy to only handle long trades and the other to handle short trades as managing multiple stop orders may be too complex.

                          You will have to use SetStopLoss() in the format it is used here:http://www.ninjatrader.com/support/h...etstoploss.htm

                          Please let me know if I can be of further assistance.
                          LanceNinjaTrader Customer Service

                          Comment


                            Hi Lance

                            I tried again and still got the same error message when compiling the strategy, ie

                            SetStopOrder1 does not exist in the context
                            SetStopOrder2 does not exist in the context

                            I have the following under Variables:

                            private double StopOrder1 = 0;
                            private double StopOrder2 = 0;

                            Also tried to change the above to

                            private int StopOrder1 = 0;
                            private int StopOrder2 = 0;

                            Not sure what else to try. Appreciate your suggestion. Thank you.

                            Beth

                            Comment


                              Hello,

                              I would need to see your full source file to verify. But based on what I've seen, there could be one or two errors. If this is a Property (user input) you will need to make StopOrder1 lower cased such that it is stopOrder1.

                              Additionally typing StopOrder1(.......) is not valid unless you have created the function.

                              You will need to type something like
                              SetStopLoss("myLong", CalculationMode.Price, BREAKOUTRANGEHIGH+ 1*TICKSIZE , false);

                              You can find the source file in (MY)Documents\NinjaTrader 7\bin\Custom\Strategy

                              Please let me know if I can be of further assistance.
                              LanceNinjaTrader Customer Service

                              Comment


                                Hi Lance

                                I followed your suggestion and am able to compile my strategy successfully with

                                SetStopLoss("",CalculationMode.Price,lowestLow-1*TickSize, false);

                                The above will work for a LongStop order. Instead of running a second strategy for ShortStop order, how can I add a similar code to exit a ShortStop order in one strategy? Please advise. Thank you.

                                Beth

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                649 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                370 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                109 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                574 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                576 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X