Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Issue with "lowest bar" function - Strategy builder

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

    Issue with "lowest bar" function - Strategy builder

    Hello,

    I am having problems using the "lowest bar function".
    I set that it should enter short when the actual bar is < or = the lowest bar in a period of 10, but i do not get any results when running in the strategy analyzer.

    Kind regards,

    Alex


    #2
    Hello Alex,

    Thank you for your post.

    Are there any errors in the Log tab of the Control Center?

    What version of NinjaTrader are you using? Please provide the entire version number. This can be found under Help -> About (Example: 8.?.?.?)

    Do you see results when running the same test on the SampleMaCrossOver strategy in NinjaTrader with the same settings as your strategy?

    Are you connected to your data feed provider when running this test?

    If you open a chart for the same instrument(s) and the same date range, then right-click the chart and select 'Reload all historical data' is the historical data showing on the chart?

    I look forward to assisting further.

    Comment


      #3
      Hello Gabi,

      thank you for the quick reply. I have some errors in the log, yes. I tried with other instrument, but got the same result. I am using version 8.1.1.7 64-bit.
      I can not see the sample strategy in the analyzer, but i have run other strategies and it seems to work correctly. I tried connecting to my data provider too.
      The historial data is showing on the whole range, yes.

      Kind regards,

      Alex

      Comment


        #4
        Hello,

        I am seeing an error in the log related to the MNQ. If you open a chart for the MNQ, are you seeing data come in?

        These other errors in the Log seem to be related to another strategy, so we can disregard those being related.

        Comment


          #5
          Hello,

          yes, MNQ works with my other strategies, but for this particular it is failing.

          Kind regards,

          Alex

          Comment


            #6
            Hello,

            If you are getting data for the MNQ on a chart, and other strategies are working as expected, the issue is likely with your strategy's logic.

            You'll need to debug the script using Prints and TraceOrders. To understand why the script is behaving as it is, such as placing orders or not placing orders when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

            In the strategy add prints (outside of any conditions) that print the date time of the bar and all values compared in every condition that places an order.

            The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.

            The debugging print output should clearly show what the condition is, what time the conditions are being compared, all values being compared, and how they are being compared.

            Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

            Further, enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.

            After enabling TraceOrders remove the instance of the strategy from the Configured list in the Strategies window and add a new instance of the strategy from the Available list.

            I am happy to assist you with analyzing the output from the output window.

            Run or backtest the script and when the output from the output window appears save this by right-clicking the output window and selecting Save As... -> give the output file a name and save -> then attach the output text file to your reply.

            Below is a link to a support article that demonstrates using informative prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.

            https://support.ninjatrader.com/s/ar...nd-TraceOrders

            Comment


              #7
              Thank you for your quick answer.
              Unfortunately I am only familiar with the drag and drop interface on the Strategy builder and have no coding knowledge.
              The command on the screenshot is the only command I used, to simplify it.
              Attached Files

              Comment


                #8
                Hello,

                You don't need to do any manual coding to debug in the Strategy Builder. You can also build prints in the Actions window under Misc -> Print.

                Developer Video: Debugging with the Strategy Builder

                I recommend watching this video for debugging in the Strategy Builder.

                That said, a basic knowledge of C# is a prerequisite to learning NinjaScript. If you are new to C#, we have some resources for basic programming concepts and getting started with NinjaScript.



                If you need assistance creating a print, please let me know.

                Comment


                  #9
                  Thank you very much for your support, really appreciate it!

                  Comment


                    #10
                    Hello,

                    I was able to create a print, but im not sure how to use this information.

                    Kind regards,

                    Alex

                    Comment


                      #11
                      Please post the full output and we are happy to help analyze the data.

                      Comment


                        #12

                        19:41:00 Lowestbar 9
                        19:42:00 Lowestbar 9
                        19:43:00 Lowestbar 7
                        19:44:00 Lowestbar 8
                        19:45:00 Lowestbar 9
                        19:46:00 Lowestbar 9
                        19:47:00 Lowestbar 9
                        19:48:00 Lowestbar 0
                        19:49:00 Lowestbar 0
                        19:50:00 Lowestbar 1
                        19:51:00 Lowestbar 0
                        19:52:00 Lowestbar 0
                        19:53:00 Lowestbar 1
                        19:54:00 Lowestbar 2
                        19:55:00 Lowestbar 3
                        19:56:00 Lowestbar 4
                        19:57:00 Lowestbar 5
                        19:58:00 Lowestbar 6
                        19:59:00 Lowestbar 7
                        20:00:00 Lowestbar 8
                        20:01:00 Lowestbar 9
                        20:02:00 Lowestbar 9
                        20:03:00 Lowestbar 9
                        20:04:00 Lowestbar 9
                        20:05:00 Lowestbar 8
                        20:06:00 Lowestbar 9
                        20:07:00 Lowestbar 9
                        20:08:00 Lowestbar 9
                        20:09:00 Lowestbar 9
                        20:10:00 Lowestbar 5
                        20:11:00 Lowestbar 6
                        20:12:00 Lowestbar 7
                        20:13:00 Lowestbar 8
                        20:14:00 Lowestbar 9
                        20:15:00 Lowestbar 9
                        20:16:00 Lowestbar 9
                        20:17:00 Lowestbar 8
                        20:18:00 Lowestbar 9
                        20:19:00 Lowestbar 9
                        20:20:00 Lowestbar 5
                        20:21:00 Lowestbar 0
                        20:22:00 Lowestbar 1
                        20:23:00 Lowestbar 2
                        20:24:00 Lowestbar 3
                        20:25:00 Lowestbar 0
                        20:26:00 Lowestbar 1
                        20:27:00 Lowestbar 0
                        20:28:00 Lowestbar 0
                        20:29:00 Lowestbar 1
                        20:30:00 Lowestbar 2
                        20:31:00 Lowestbar 3
                        20:32:00 Lowestbar 4
                        20:33:00 Lowestbar 5
                        20:34:00 Lowestbar 6
                        20:35:00 Lowestbar 0
                        20:36:00 Lowestbar 0
                        20:37:00 Lowestbar 1
                        20:38:00 Lowestbar 2
                        20:39:00 Lowestbar 0
                        20:40:00 Lowestbar 1
                        20:41:00 Lowestbar 2
                        20:42:00 Lowestbar 3
                        20:43:00 Lowestbar 0
                        20:44:00 Lowestbar 1
                        20:45:00 Lowestbar 2
                        20:46:00 Lowestbar 3
                        20:47:00 Lowestbar 4
                        20:48:00 Lowestbar 5
                        20:49:00 Lowestbar 6
                        20:50:00 Lowestbar 7
                        20:51:00 Lowestbar 0
                        20:52:00 Lowestbar 1
                        20:53:00 Lowestbar 2
                        20:54:00 Lowestbar 0
                        20:55:00 Lowestbar 1
                        20:56:00 Lowestbar 2
                        20:57:00 Lowestbar 3
                        20:58:00 Lowestbar 4
                        20:59:00 Lowestbar 5
                        21:00:00 Lowestbar 0
                        21:01:00 Lowestbar 1
                        21:02:00 Lowestbar 2
                        21:03:00 Lowestbar 0
                        21:04:00 Lowestbar 1
                        21:05:00 Lowestbar 2
                        21:06:00 Lowestbar 3
                        21:07:00 Lowestbar 0
                        21:08:00 Lowestbar 0
                        21:09:00 Lowestbar 1
                        21:10:00 Lowestbar 2
                        21:11:00 Lowestbar 3
                        21:12:00 Lowestbar 4
                        21:13:00 Lowestbar 5
                        21:14:00 Lowestbar 6
                        21:15:00 Lowestbar 7
                        21:16:00 Lowestbar 8
                        21:17:00 Lowestbar 9
                        21:18:00 Lowestbar 9
                        21:19:00 Lowestbar 3
                        21:20:00 Lowestbar 0
                        21:21:00 Lowestbar 1
                        21:22:00 Lowestbar 0
                        21:23:00 Lowestbar 0
                        21:24:00 Lowestbar 1
                        21:25:00 Lowestbar 2
                        21:26:00 Lowestbar 3
                        21:27:00 Lowestbar 4
                        21:28:00 Lowestbar 5
                        21:29:00 Lowestbar 6
                        21:30:00 Lowestbar 7
                        21:31:00 Lowestbar 8
                        21:32:00 Lowestbar 9
                        21:33:00 Lowestbar 4
                        21:34:00 Lowestbar 5
                        21:35:00 Lowestbar 6
                        21:36:00 Lowestbar 7
                        21:37:00 Lowestbar 8
                        21:38:00 Lowestbar 9
                        21:39:00 Lowestbar 9
                        21:40:00 Lowestbar 9
                        21:41:00 Lowestbar 0
                        21:42:00 Lowestbar 0
                        21:43:00 Lowestbar 0
                        21:44:00 Lowestbar 0
                        21:45:00 Lowestbar 1
                        21:46:00 Lowestbar 0
                        21:47:00 Lowestbar 0
                        21:48:00 Lowestbar 1
                        21:49:00 Lowestbar 2
                        21:50:00 Lowestbar 3
                        21:51:00 Lowestbar 4
                        21:52:00 Lowestbar 5
                        21:53:00 Lowestbar 6
                        21:54:00 Lowestbar 7
                        21:55:00 Lowestbar 8
                        21:56:00 Lowestbar 9
                        21:57:00 Lowestbar 9
                        21:58:00 Lowestbar 5
                        21:59:00 Lowestbar 0
                        22:00:00 Lowestbar 0

                        I am not sure if this is right.​
                        Attached Files

                        Comment


                          #13
                          Hello Alex,

                          LowestBar() is providing the BarsAgo number of bars the lowest bar was in the range.


                          Are you wanting the number of the bar or are you wanting the lowest price value in the range of the series?

                          If so, use the MIN indicator to get the lowest price value instead of the lowest barsago number.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Hello ChelseaB,

                            oh, that explains much!
                            Yes, I actually was looking for the lowest price value in the range of the series.
                            Oh, thank you, that is of much help.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by NullPointStrategies, Yesterday, 05:17 AM
                            0 responses
                            67 views
                            0 likes
                            Last Post NullPointStrategies  
                            Started by argusthome, 03-08-2026, 10:06 AM
                            0 responses
                            142 views
                            0 likes
                            Last Post argusthome  
                            Started by NabilKhattabi, 03-06-2026, 11:18 AM
                            0 responses
                            76 views
                            0 likes
                            Last Post NabilKhattabi  
                            Started by Deep42, 03-06-2026, 12:28 AM
                            0 responses
                            47 views
                            0 likes
                            Last Post Deep42
                            by Deep42
                             
                            Started by TheRealMorford, 03-05-2026, 06:15 PM
                            0 responses
                            51 views
                            0 likes
                            Last Post TheRealMorford  
                            Working...
                            X