Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Wait 1 Bar

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

    #16
    Thanks
    Yes confirm NOT related to entry or exit

    to confirm i am using OnPriceChange, but i do wish for the int = 2 to remain during the next bar thru completion

    Please confirm the counter and the OnBarUpdate can only be implemented in the Unlocked script and cannot be done in the Strategy Builder

    Comment


      #17
      ALSO SOMETHING weird just occur with my script, you kinda gave me an idea that when the int = 2 i could have a bool change from false to True and then possible could the bar using the bool

      but when i added another bool statement, then my compile of the code have a popup that said Cannot compile strategy error (never saw this before, it then opens a Ninjascript editor, if i compile all there i have no error

      Comment


        #18
        Hello DTSSTS,

        I can confirm the Strategy Builder is not capable of math, including adding 1 to an int variable.

        In the NinjaScript Editor, what is the compile error?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #19
          the error was that i had my LongTradeCount int and I named the bool LongTradeCount2, Ninja did finally show an error on compile script that the names were the same (which they are not, but that is now the case) So Now i will be force to unlock the code to fix it

          Comment


            #20
            Hello DTSSTS,

            What is the full and exact error message?

            May we have a screenshot?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #21
              None of this matters now, I created a bool to place with my int = 2 and try and count the bars the bool was true vs the int = 2

              the int was name LongTradeCount int default 1
              so i named the bool LongTradeCount2 default 2, i did this from a rename of a bool i was not using, it did not appear to edit, so I did it again, what happen i believe was in the lower section of the list it did indeed create the new bool, which i could not see, so I then edited the bool again with the same name (which i of course did not realize) the Strategy builder allow me to do this with the same name

              when i tried to compile and got the error could not create strategy it did not tell me the issue and when the editor was opened i click compile and no error were shown, so i close the strategy builder BIG MISTAKE now the ninjsscript editor does find the comple error and tells me of the strategy already contains the definition of LongTradeCount2

              so i assume i have to unlock the code to fix this, but the script editor will not open the strategy or any strategy until it is fix, YOU cannot fix what you cannot access

              What do i do

              Comment


                #22
                Hello DTSSTS,

                Compile errors are shown in the NinjaScript Editor.

                Please follow the instructions below to see where the errors are coming from after compiling an indicator in NinjaTrader 8. This will allow you to debug the indicator/strategy or remove it from your PC. If you are wondering why you receive an error when compiling only one indicator, it is because NinjaTrader always compiles all indicators and strategies - not just one. This is done to give you the highest runtime performance possible.
                • Open NinjaTrader
                • From the Control Center click the New menu -> select NinjaScript Editor
                • On the right open a script such the Indicators -> ADL script
                • Right click in the window and select Compile to compile all scripts
                • At the bottom of the window a new section will appear where you can find the error locations.
                • From there you have the option to comment out offending code sections, correct references, remove the complete indicator, or debug it to be able to compile again.
                If you are unsure as to what the error is indicating, please send me a screenshot of the error with the error column fully expanded so that I may read the entire error message.

                (Click and drag on the small faint separator between column heads, just to the right of the Error column, to expand that column)

                To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.
                Click here for instructions

                Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screen shot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.
                Click here for detailed instruction

                Last, I am including a link to the help guide with further suggestions.
                https://ninjatrader.com/support/help...jascript_p.htm

                Please let me know if you would like assistance resolving the error or if you are not using the latest version of NinjaTrader.

                Chelsea B.NinjaTrader Customer Service

                Comment


                  #23
                  i see the error in the compile area from the NinjsScript Editor, You cannot open the script if it has error, i can disable it from compiling and open it. Even if I can open it and remove the line of code with the error, which i can if i block it from compiling, either was i end up with an unlocked code. Which I do not want at this point. I do have a backup from Saturday evening so NOT a complete disaster.

                  So i have created a version from the backup

                  Thanks for the help

                  Comment


                    #24
                    NOT sure I am clear here

                    you wrote "I can confirm the Strategy Builder is not capable of math, including adding 1 to an int variable."

                    I have created in strategy builder a variable LongTradeCount with default of 1

                    I have rules and condtion sets with action to include "do the following" LongTradeCount = 2

                    I then have condition sets to trigger order that condition include LongTradeCount = 2

                    and on Trigger conditions "do the following" Buy Long and LongTradeCount = 3

                    ARE YOU SAYING THE THE Strategy Builder is NOT capable of changing those int number back and forth 1 or 2 or 3

                    OR IS ALL OF MY ABOVE CHANGES actually working (they seem to be)
                    Thanks

                    Comment


                      #25
                      Hello DTSSTS,

                      A counter involves adding 1 to the existing value (incrementing).

                      In the Strategy Builder you can directly set the value of an int. If you want to set the int to 2 or 3, yes you can do this.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #26
                        ok I place drawing on the chart to see when the directly set values are change and that is insightful and mostly working as expected. an showing me where to mekes changes. NOT even thinking I need a counter because what i wanted to happen with the counter was actually happening without a counter,

                        SO I AM GOOD ON THAT AND THANKS FOR ALL YOUR HELP

                        in my testing what i am totally not understanding *** I have strategy running 2 times set to 2 different sim accounts, 1 is directly applied to the chart loading 10 days of data, the other is applied from the control center with the same settings and the same 10 days of data

                        1 things need to know, the one directly on the chart shows the drawings, but the one running from the control center does NOT

                        IS THAT EXPECTED drawing behavior?

                        Comment


                          #27
                          Hello DTSSTS,

                          This is expected behavior. For plots, drawing objects, or renderings to appear on a chart, the strategy must be applied to the chart.

                          Below is a link to the Strategy Builder where this is discussed.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #28
                            Same Strategy (if you remember my request to Control Panel to run Strategies from BARS to load vs Days to load. NOT sure if this is also a side effect of that as well.

                            First image takes the trade next bar after the Blue Diamond at the arrow *this was strategy applied to a stock chart" Second image is the actual trade take from strategy running in control panel

                            both set to load 10 days - this is NOT a good thing

                            Attached Files

                            Comment


                              #29
                              Hello DTSSTS,

                              Same data, same logic, same trades.

                              Use prints to find out what is different.

                              Print the time of the bar, print all values used in all conditions and enable TraceOrders. Save the output in the output window to a text file (Save as).


                              I am happy to assist with analyzing the output.
                              Chelsea B.NinjaTrader Customer Service

                              Comment


                                #30
                                Same logic same trades, just my point however, Control Panel vs Chart Not exactly same candlesticks when dealing with any tick driven candlestick

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by NullPointStrategies, Yesterday, 05:17 AM
                                0 responses
                                65 views
                                0 likes
                                Last Post NullPointStrategies  
                                Started by argusthome, 03-08-2026, 10:06 AM
                                0 responses
                                139 views
                                0 likes
                                Last Post argusthome  
                                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                                0 responses
                                75 views
                                0 likes
                                Last Post NabilKhattabi  
                                Started by Deep42, 03-06-2026, 12:28 AM
                                0 responses
                                45 views
                                0 likes
                                Last Post Deep42
                                by Deep42
                                 
                                Started by TheRealMorford, 03-05-2026, 06:15 PM
                                0 responses
                                50 views
                                0 likes
                                Last Post TheRealMorford  
                                Working...
                                X