• 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.

Announcement

Collapse
No announcement yet.

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.
    https://ninjatrader.com/support/foru...040#post786040
    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 cmarkb, Today, 02:15 AM
          0 responses
          1 view
          0 likes
          Last Post cmarkb
          by cmarkb
           
          Started by terminatorT1000, Today, 01:23 AM
          0 responses
          6 views
          0 likes
          Last Post terminatorT1000  
          Started by jointnusa, Today, 01:00 AM
          0 responses
          6 views
          0 likes
          Last Post jointnusa  
          Started by jointnusa, Today, 12:59 AM
          0 responses
          5 views
          0 likes
          Last Post jointnusa  
          Started by alstondn, Today, 12:15 AM
          0 responses
          5 views
          0 likes
          Last Post alstondn  
          Working...
          X