Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop execution if less than supertrend line

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

    #31
    Thanks Zach. Unfortunately I'm not able to compile this strategy as I'm missing a lot of the custom items you reference in it.

    I did take a look and see no reason why it wouldn't process the print statement. If you make any code changes, you need to compile and also reload NinjaScript. If you made these changes to a currently running strategy, they are not seen until you disable / enable the strategy.
    Ryan M.NinjaTrader Customer Service

    Comment


      #32
      I think i was just expecting this to magically create output without it actually running. This must have to be runnnig live or at least have the simulator running I assume? Anyway to have it produce output based on past data. Or what's the best way to do this without it running live, just have the simulator running?

      Comment


        #33
        Yes, you have to run the strategy, in order to process its Print statements and then view output for it. Print statements will still be called on the historical data you're using. Maybe it would be worthwhile for you to create a new script to practice with Print() statements to see how they work. They're fundamental in tracking down script behavior.
        Ryan M.NinjaTrader Customer Service

        Comment


          #34
          I still don't understand the point of this, its getting frustrating, you guys should really set up a video tuturiol on print statements or have some decent instructions on how to analyze this. Im running the simulator on my strategy and all i see in the output window is primary series date/time and then secondary series date time. Don't see what good this is doing me.

          Comment


            #35
            Thanks for the feedback. We're always looking to expand our educational offerings.

            The print statements were provided to you so you can see in practice how bars from different series are referenced in relation to each other. We detail this as well in our documentation here, but sometimes it makes a lot more sense to have the strategy show it to you.

            We understand debugging and working with code in general can be time consuming and frustrating. There is for sure a learning curve to all of it. If you would like instead professional help developing a strategy to your specifications, please consider working with one of our 3rd party NinjaScript consultants:
            Ryan M.NinjaTrader Customer Service

            Comment


              #36
              Where?? Where do you detail it in the documentation? The links you sent me had nothing in detail. What is it im supposed to be seeing in the ouput. This is all I see...
              Primary series time: 2/7/2012 3:10:00 PM Secondary Series Time: 2/7/2012 3:10:00 PM
              Primary series time: 2/7/2012 3:20:00 PM Secondary Series Time: 2/7/2012 3:20:00 PM
              Primary series time: 2/7/2012 3:30:00 PM Secondary Series Time: 2/7/2012 3:30:00 PM
              Primary series time: 2/7/2012 3:40:00 PM Secondary Series Time: 2/7/2012 3:40:00 PM

              What is this supposed to tell me.

              Comment


                #37
                It was inline link, you might have missed it.

                Print to the console/output window is basic Hello World stuff.

                You can also attach visual studio debugger, there are some posts about that, but its complicated compared to just using print





                Originally posted by zachj View Post
                Where?? Where do you detail it in the documentation? The links you sent me had nothing in detail. What is it im supposed to be seeing in the ouput. This is all I see...
                Primary series time: 2/7/2012 3:10:00 PM Secondary Series Time: 2/7/2012 3:10:00 PM
                Primary series time: 2/7/2012 3:20:00 PM Secondary Series Time: 2/7/2012 3:20:00 PM
                Primary series time: 2/7/2012 3:30:00 PM Secondary Series Time: 2/7/2012 3:30:00 PM
                Primary series time: 2/7/2012 3:40:00 PM Secondary Series Time: 2/7/2012 3:40:00 PM

                What is this supposed to tell me.

                Comment


                  #38
                  They show what data is available for each given time stamp. Let's look at this one:
                  Primary series time: 2/7/2012 3:10:00 PM Secondary Series Time: 2/7/2012 3:10:00 PM

                  Let's say your primary is 60 minute, then the 3:10 bar consists of all trading from 2:10 - 3:10.

                  Let's say your secondary is 5 minute, then the 3:10 bar consists of all trading from 3:05 - 3:10.

                  The point of reference for both these time stamps is the primary bar, or BarsInProgress == 0.

                  Check the "How bar data is referenced" section, which we also linked earlier in post 25 as well.

                  The documentation made a lot more sense once I started Printing time stamps to see how multiseries bars relate. You may be at a different point in your NinjaScript education for them to be of any use yet. If you find any of these concepts too challenging, take a step back and work from what you know, and then hopefully build on that ready to learn the next thing. We've been replying in this thread with these techniques to help you learn NinjaScript. If you have a specific question, feel free to ask.
                  Last edited by NinjaTrader_RyanM1; 02-07-2012, 05:05 PM.
                  Ryan M.NinjaTrader Customer Service

                  Comment


                    #39
                    No I didn't miss any of the links, I read them all, how bar data is referenced etc. I understand them. But Im needing more meatier detail on the bar progressions. Like what is this stuff that Sledge had put in earlier posts..
                    Code:
                    Print ( " ["+BarsInProgress+"]=" + String.Format( "{0,7}" , String.Format( "{0:####.00}" ,Close[0])) + " ," + String.Format( "{0:MM/dd HH:mm:ss}",Time[0]) +
                                " Closes [0][0]=" + String.Format( "{0:0.00}" ,Closes[0][0]) + " ," + String.Format( "{0:MM/dd HH:mm:ss}",Times[0][0]) + 
                                " Closes[1][0]=" + String.Format( "{0:0.00}" ,Closes[1][0]) + " ," + String.Format( "{0:MM/dd HH:mm:ss}",Times[1][0]) +
                                " SuperTrend(Closes[0], 14, 2.618, true).UpTrend[1]" + String.Format( "{0:0.00}" ,SuperTrend(Closes[0], 14, 2.618, true).UpTrend[1]) ) ;
                    Is this something I would get as output? What is this print to console thing, how do I do this?

                    How do I interpret this? ( " ["+BarsInProgress+"]=" + String.Format( "{0,7}" , String.Format( "{0:####.00}" ,Close[0])) + " ," + String.Format( "{0:MM/dd HH:mm:ss}",Time[0]) +

                    For instance what is String.Format{0,7} ? And what is this? String.Format( "{0:####.00}

                    Comment


                      #40
                      That is so I could keep everything in alignment on the output window. It is C# specific. I googled how to format strings in C#.



                      For the console window in NinjaTrader -> From Command Center - Tools->Output Window



                      Originally posted by zachj View Post
                      No I didn't miss any of the links, I read them all, how bar data is referenced etc. I understand them. But Im needing more meatier detail on the bar progressions. Like what is this stuff that Sledge had put in earlier posts..
                      Code:
                      Print ( " ["+BarsInProgress+"]=" + String.Format( "{0,7}" , String.Format( "{0:####.00}" ,Close[0])) + " ," + String.Format( "{0:MM/dd HH:mm:ss}",Time[0]) +
                                  " Closes [0][0]=" + String.Format( "{0:0.00}" ,Closes[0][0]) + " ," + String.Format( "{0:MM/dd HH:mm:ss}",Times[0][0]) + 
                                  " Closes[1][0]=" + String.Format( "{0:0.00}" ,Closes[1][0]) + " ," + String.Format( "{0:MM/dd HH:mm:ss}",Times[1][0]) +
                                  " SuperTrend(Closes[0], 14, 2.618, true).UpTrend[1]" + String.Format( "{0:0.00}" ,SuperTrend(Closes[0], 14, 2.618, true).UpTrend[1]) ) ;
                      Is this something I would get as output? What is this print to console thing, how do I do this?

                      How do I interpret this? ( " ["+BarsInProgress+"]=" + String.Format( "{0,7}" , String.Format( "{0:####.00}" ,Close[0])) + " ," + String.Format( "{0:MM/dd HH:mm:ss}",Time[0]) +

                      For instance what is String.Format{0,7} ? And what is this? String.Format( "{0:####.00}

                      Comment


                        #41
                        Oh i thought you were saying print to console and output window were two different things. So I can see the time stamps, which basically just tells me when the primary is trading and when the secondary is trading. Is this as advanced as it gets? I don't see how that tells me anything revealing. If my primary is a 2minute bar ill get one time stamp to represent the activity between say 9-9:02. Then if my secondary is a 1min ill get two stamps, one to represent activity between 9-9:01 and another for 9:01-9:02.

                        I would need to know more than this. Would need to know when the secondary price (1min bar close) becomes < line formed by the primary time frame(2min period) and why it doesn't exit the trade when this occurs.
                        Last edited by zachj; 02-07-2012, 09:03 PM.

                        Comment


                          #42
                          Great to hear you're making progress. Unfortunately you can't change the bar referencing model historically. It's designed conservatively, to prevent using lower time frames to "peek" ahead at future prices.

                          Would need to know when the secondary price (1min bar close) becomes < line formed by the primary time frame(2min period) and why it doesn't exit the trade when this occurs.
                          It should exit when the conditions are valid. To confirm you will need to expand your Print() knowledge to include the values used in your condition. As you can see from the time stamp illustration, it will use the same time stamp for comparison, which for close will be the same value for primary/secondary series.

                          The main value of multi-time frames in backtests is if you wanted to confirm signals on multiple time frames, or provide more granularity for more realistic order fills.
                          Ryan M.NinjaTrader Customer Service

                          Comment


                            #43
                            I still don't see the value of these time stamps. I get a lot more info just looking at the entry and exit points on the chart in the strategy analyzer. Either way I figured it out. There was nothing wrong with that particular line of code I was fussing over. The only thing I had to do was put a BIP before all the if statements in the code sections for long entry, short entry, long exit, and short exit. Simple.

                            Comment


                              #44
                              Even though Im still not seeing the time stamp importance yet, thanks for all your time and trying to help me out guys. The link that was provided that talked about commenting out sections of code to take them out of the equation and pinpoint any issues really helped me out. Cheers.

                              Comment


                                #45
                                Glad you're able to make some progress by simplifying, zach. Thanks for following up and enjoy your weekend.
                                Ryan M.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by CarlTrading, 03-31-2026, 09:41 PM
                                1 response
                                68 views
                                0 likes
                                Last Post NinjaTrader_ChelseaB  
                                Started by CarlTrading, 04-01-2026, 02:41 AM
                                0 responses
                                37 views
                                0 likes
                                Last Post CarlTrading  
                                Started by CaptainJack, 03-31-2026, 11:44 PM
                                0 responses
                                62 views
                                1 like
                                Last Post CaptainJack  
                                Started by CarlTrading, 03-30-2026, 11:51 AM
                                0 responses
                                62 views
                                0 likes
                                Last Post CarlTrading  
                                Started by CarlTrading, 03-30-2026, 11:48 AM
                                0 responses
                                53 views
                                0 likes
                                Last Post CarlTrading  
                                Working...
                                X