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

DrawText Slope

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

    DrawText Slope

    Hi,

    I've been able to adapt another indicator
    Last edited by stockgoblin; 03-25-2013, 05:16 PM.

    #2
    While this would not be very efficient and could put a strain on the system to check all the previous bars every new bar you could do so using a for loop.

    C# iteration statements (for, foreach, do, and while) repeatedly execute a block of code. You use those statements to create loops or iterate through a collection.


    Specifically a foreach loop if you need to check ALL previous bars: http://msdn.microsoft.com/en-us/libr.../ttw7t8t6.aspx

    Additionally I don't know how much you've looked into calculating slopes but this may be of use: http://www.bigmiketrading.com/wiki/t...-in-indicators
    LanceNinjaTrader Customer Service

    Comment


      #3
      Hi

      Thanks for the info.
      Last edited by stockgoblin; 03-25-2013, 05:16 PM.

      Comment


        #4
        This depends on what you're looking to do with this data. Are you going to draw something on the chart or do you want to store this for later reference?
        LanceNinjaTrader Customer Service

        Comment


          #5
          Yes, I'd like to Identify
          Last edited by stockgoblin; 03-25-2013, 05:16 PM.

          Comment


            #6
            In this case you could just draw the object when it occurs. When you load the indicator onto the chart it would start at bar 0 and progress over the historical data drawing the objects along the way.

            Using your example, something like

            Code:
            if(Close[0]-Close[1] == Close[1]-Close[2]) 
            //draw line
            might work.

            For a list of drawing object methods expand this link: http://www.ninjatrader.com/support/h...ml?drawing.htm


            However if you needed to check more than just the previous two values you would need to create a loop.
            LanceNinjaTrader Customer Service

            Comment


              #7
              Yes, I do need to check
              Last edited by stockgoblin; 03-25-2013, 05:16 PM.

              Comment


                #8
                Those C# reference links will be a good place to start. Additionally I often find this website to be more educational for newer users: http://www.dotnetperls.com/for

                Additionally we have recently begun offering premium education courses for learning NinjaScript: http://www.ninjatrader.com/PremiumEducation.php

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

                Comment


                  #9
                  Hey, that's great. I'll check that out.
                  Last edited by stockgoblin; 03-25-2013, 05:17 PM.

                  Comment


                    #10
                    Hello,

                    While you wouldn't have to it would probably be easier to use a DataSeries to store the slope values. You could then loop through that series using the for loop.



                    In terms of resources the time frame isn't going to be as important as the total number of bars loaded on the chart. The more bars, the more data it will have to loop over.
                    LanceNinjaTrader Customer Service

                    Comment


                      #11
                      Wow,

                      Thanks for that link. The SampleCustomDataSeries.zip indicator is exactly what I need to learn from and experiment with adapting them and building on them. Are there more of these Sample indicators in one place?

                      Comment


                        #12
                        Yeah no problem. All of our samples and tips can be found on the main page of our forums.

                        Following are links to all available NinjaScript reference samples within this forum section: Strategy Reference Samples (NinjaTrader 8) - also applicable to NT7 Using a time filter to limit trading hours (http://www.ninjatrader.com/support/forum/showthread.php?t=3226) Using multiple entry/exit signals simultaneously

                        LanceNinjaTrader Customer Service

                        Comment


                          #13
                          Nice, I got it!
                          Last edited by stockgoblin; 03-25-2013, 05:15 PM.

                          Comment


                            #14
                            Your NinjaScript / C# Code will always be logically processed and evaluate according to your set logic – this can of course lead to unexpected results at times, thus we would suggest to simplify and debug your code to better understand the event sequence it would go through - unfortunately we cannot offer such debug or code modification services here, but please see the provided resources below to help you proceed productively :

                            First of all you would want to use Print() statements to verify values are what you expect. Its my assumption that the script my have an error if you were to open up the output window (tools -> output window) - Debugging your NinjaScript code.

                            For strategies add TraceOrders = true to your Initialize() method and you can then view valuable output related to strategy submitted orders through Tools > Output window - TraceOrders

                            It may also help to add drawing objects to your chart for signal and condition confirmation - Drawing Objects.

                            If you would prefer the debug assist of a professional NinjaScript consultant, please send mail to support [at] ninjatrader [com]
                            In the subject: ATTN Lance
                            In the body: please include this forum post link
                            LanceNinjaTrader Customer Service

                            Comment


                              #15
                              did you just turn into a machine? Ha!

                              Thanks for your help. I'll go it alone

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by mattbsea, Today, 05:44 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post mattbsea  
                              Started by RideMe, 04-07-2024, 04:54 PM
                              6 responses
                              31 views
                              0 likes
                              Last Post RideMe
                              by RideMe
                               
                              Started by tkaboris, Today, 05:13 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post tkaboris  
                              Started by GussJ, 03-04-2020, 03:11 PM
                              16 responses
                              3,282 views
                              0 likes
                              Last Post Leafcutter  
                              Started by WHICKED, Today, 12:45 PM
                              2 responses
                              20 views
                              0 likes
                              Last Post WHICKED
                              by WHICKED
                               
                              Working...
                              X