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

Large bar/candle

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

    Large bar/candle

    Hi,

    I am trying to figure out the logic for an indicator. Can some one help please !

    Highlight the bar/candle with a dot or arrow on top (Or) colour the bar in a different colour. This bar can be anywhere from 50 to 100 percent larger than the average size of the bars in the
    lookback period.

    Variables are lookback period; That can be 5,10,20 ....... bars
    --% size larger than previous 'n' bars. Can be 10%, 20%, 30%, 50%, 75%, 100% .....

    Regards

    Neil

    #2
    Hello Neil,

    This thread will remain open for any community members that would like to create this custom logic as a convenience to you.

    You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.

    That said, I am happy to answer any questions you may have about NinjaScript if you decide to code this yourself.

    You can use a for loop to loop through 0 bars ago to the period and compare high minus low distance and save this to an array and then average these values.

    To set the color of a bar this can be done by setting the BarBrush.
    https://ninjatrader.com/support/help...8/barbrush.htm

    Below is a link to a forum post with helpful information on getting started with NinjaScript.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you.

      Comment


        #4
        Originally posted by toughnedglass View Post
        Hi,

        I am trying to figure out the logic for an indicator. Can some one help please !

        Highlight the bar/candle with a dot or arrow on top (Or) colour the bar in a different colour. This bar can be anywhere from 50 to 100 percent larger than the average size of the bars in the
        lookback period.

        Variables are lookback period; That can be 5,10,20 ....... bars
        --% size larger than previous 'n' bars. Can be 10%, 20%, 30%, 50%, 75%, 100% .....

        Regards

        Neil
        //In OnBarUpdate()
        Code:
        if (Range[0] > (1 + multiplier/100.0) * SMA(Range, lookbackperiod)[1])
        {
        //do that which you want now
        }
        This is the barest-bones code for the logic that you specified. It assumes that the percentage is stated as a percentage. You may need to write a sanity check to handle those who specify the percentage as a decimal fraction (i.e, 0.10 instead of 10%).

        Create properties for multiplier and lookbackperiod, so that you can change the values from the PropertyGrid.
        Last edited by koganam; 04-06-2020, 02:43 PM. Reason: Corrected spelling

        Comment


          #5
          Thank you, will give it a go.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by rocketman7, Today, 09:41 AM
          2 responses
          4 views
          0 likes
          Last Post rocketman7  
          Started by traderqz, Today, 09:44 AM
          1 response
          3 views
          0 likes
          Last Post traderqz  
          Started by rocketman7, Today, 02:12 AM
          7 responses
          31 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by guillembm, Yesterday, 11:25 AM
          3 responses
          16 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by junkone, 04-21-2024, 07:17 AM
          10 responses
          150 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X