• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


Green and Red bars counter

  • Filter
  • Time
  • Show
Clear All
new posts

    Green and Red bars counter

    is there an indicator that counts number of green and red bars starting from a specefic time ?
    it wil plot on a corner the number of green candles and the number of red candles, and it should be updated automatically on each bare close.
    for example i want to know how many green candles and red candles exist starting from for example 10 am .
    it will plots for me :
    green candles : 700 for example
    red candles : 600

    Hello elkhatabi,

    Thanks for your post and welcome to the NinjaTrader forums!

    I am not aware of such an indicator.

    If you would like to create this indicator yourself we can provide you with references to get you started with Ninjascript which is based on C# .Net

    Alternatively, if you would like it created for you, we can provide you with references to 3rd party programmers who would be happy to provide this service.
    Paul H.NinjaTrader Customer Service


      Hello Paul,
      thank you very much!
      yes, a would be glad to create it with your help!
      the base algorithm for the indicator is represented in the picture below. but unfortunately i don't know how to implement it in ninja trader
      thanks alot
      Attached Files


        Hello elkhatabi,

        Thanks for your reply.

        Based on your goals, I would suggest using Bars.ISFirstBarOfSession as a true/false property that you can reset your two colored bar counters. You would create Int type variables to use as counters. For the time element, you can compare the bar close time Time[0] to a time you specify to begin counting (example provided below). If the Close[0] > Open[0] then you have a green bar. If the Close[0] < Open[0] then you have a Red bar (I do not know if you wish to consider a doji bar where Close[0] = Open[0] but that is also there). To present the data on the chart, I recommend using Draw.TextFixed() to display the counts (and perhaps the start time for reference) in any of the 4 corners of the chart. I'll attach help guide links to assist with the different methods:
        This is an example of a time filter (strategy but can use same code in indicator): https://ninjatrader.com/support/help...to_limit_t.htm

        Just to be clear, as we are a small team, we do not provide code writing or debugging services. You will need to go through the reference materials to get started.

        NinjaScripts are built on C#. While we do not provide programming education services in the Support Department, there are a vast number of educational C# resources external to NinjaTrader and we do have some tutorials and tools that can assist in the learning process.

        Many users report that a good way to start before fully learning C# is to go through the NinjaTrader 7 NinjaScript tutorials in the help documentation to get a fundamental grasp on .NET framework and how it is used in NinjaScript. From there I suggest looking at the Code Breaking changes for NinjaTrader 8 to understand the differences between NinjaTrader 7 and NinjaTrader 8. You can view the tutorials for NinjaTrader 7 here: https://ninjatrader.com/support/help...?tutorials.htm

        Although we do not currently provide NinjaScript tutorials like in NinjaTrader 7, we do provide in-depth help documentation on developing NinjaScripts for NinjaTrader 8. We also provide samples and a complete reference of the language. More in depth educational resources can be found elsewhere throughout the internet.
        You can find the educational resources here: http://ninjatrader.com/support/helpG..._resources.htm

        Once you have a basic understanding of C#, I suggest following the documented Code Breaking changes between NinjaTrader 7 and NinjaTrader 8. This page also gives an overview for NinjaScripts in NinjaTrader 8. You can find the Code Breaking changes here: http://ninjatrader.com/support/helpG...ng_changes.htm

        Other users have written in about this information in our support forums here: https://ninjatrader.com/support/foru...d.php?p=488807

        Also available are webinars on the NinjaScript editor and the Strategy Builder. The Strategy Builder can be used to generate NinjaScript syntax for NinjaScript strategies. You may wish to create a strategy and clicking View Code after each piece of logic created in the Builder to observe the generated syntax.
        Strategy Builder 301: https://www.youtube.com/watch?v=HCyt90GAs9k
        NinjaScript Editor 401: https://www.youtube.com/watch?v=K8v_2ONBbqI

        You can register for live webinars here: https://ninjatrader.com/PlatformTraining

        Our documentation will be your best friend while developing, and the complete supported NinjaScript interface can be referenced here: http://ninjatrader.com/support/helpGuides/nt8/en-us/
        The information above is publicly available.

        Finally, we also have a vast EcoSystem of NinjaScript Consultants that would be happy to write or modify any NinjaScript at your request. If those services interest you, we can have a representative of our EcoSystem reach out with more information.

        Paul H.NinjaTrader Customer Service


          i have another question,please
          let's say i created an indicator and i want to sell it to traders, how can i assure that the indicator will work only for the person i sold to.
          in other words, how to let the indicator work for one ip adress, if the person i sold it to gave to another trader, it won't work for him.
          thanks in advance


            Hello elkhatabi,

            Thank you for your continued interest in NinjaTrader!

            There are various methods of licensing your products that you have created for NinjaTrader and controlling who has access to them.

            Please send an email to [email protected] with this post referenced so our team can further discuss how you can move forward in this area.
            Ryan L.NinjaTrader Customer Service


            Latest Posts


            Topics Statistics Last Post
            Started by mtamaku, Today, 09:19 AM
            0 responses
            Last Post mtamaku
            by mtamaku
            Started by traderMNQ, Today, 09:00 AM
            3 responses
            Last Post NinjaTrader_ChrisL  
            Started by jransom, Today, 09:08 AM
            0 responses
            Last Post jransom
            by jransom
            Started by Irukandji, Today, 08:27 AM
            1 response
            Last Post NinjaTrader_Manfred  
            Started by brunoviveiros, Today, 08:18 AM
            0 responses
            Last Post brunoviveiros