Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using BarsInARow as index?

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

    #16
    Correct, but I could not seem to get it to reference the last bull bar open when I added your code snippet. I kept getting compile errors as if the reference wasn't correct or there at all.


    I'm running Ninjatrader 8.1.1.7 if it matters.

    Comment


      #17
      Originally posted by Conceptzx View Post
      I've tried Open[lastBullOpen], lastBullindex, lastBullOpen, and n.Open[lastBullIndex], etc. Trying to define the first of the two blue candles for the bar calculation and it's always returned a cs0103.

      I'm trying to get line 759 to work at this time. It's currently disabled in the cs file so it could be in a compiled state. .

      (I have a couple different additions I'm working on so you'll see some things disabled and others active and unfinished.)
      Upon further investigation, the CandleStickPatternLogic is part of a different class that does not have the private objects defined in that class: public class CandleStickPatternLogic
      The private objects such as lastBullOpen, lastBullIndex, etc. are part of the indicator class: public class CandlestickPattern : Indicator

      The difference between access modifiers and how they are used between different classes is more of a general C# topic and is not specific to NinjaScript. This indicator is a little bit complex to work with due to that custom class CandleStickPatternLogic at the bottom of the file. If you require more hands-on development assistance with this indicator, you could consider contacting 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 NinjaTrader Ecosystem team to follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request or provide one-on-one educational services.

      Please let me know if I may be of further assistance.

      Comment


        #18
        Can you elaborate a little further about the public / private class relationship or suggest a portion of the help guide I should read into?

        Comment


          #19
          Originally posted by Conceptzx View Post
          Can you elaborate a little further about the public / private class relationship or suggest a portion of the help guide I should read into?
          First, I would like to reiterate something from one of my previous replies:
          Are you currently editing the existing CandleStickPattern indicator that comes with NinjaTrader, or have you created a copy of this script that you are modifying? The script you have provided has the same name and I am not able to move it into my own indicators folder without receiving several errors. If you have not already, please right-click the script and select Save As then give the script a new name such as CandleStickPatternModified in order to save the script into its own new file and prevent errors related to the modification of a system script.
          Have you followed these steps to work with a copy of the CandleStickPattern script? If not, the original script will overwrite your changes and any changes you made will be lost. Please follow these steps if you have not copied this script already:
          • Open the original CandleStickPattern script in the NinjaScript Editor
          • Right-click the window and select Save As. Give the copy a name.
          • Press F5 to compile. There will be compile errors due to duplicate names that crossover between the original and your copy. You should find and replace the duplicated items with a new name. Compile in between each new change to check for additional errors.
            • For example, change the "public enum ChartPattern" to a new name such as "public enum ChartPatternModified"
            • Change "public class CandleStickPatternLogic" to "public class CandleStickPatternLogicModified"
            • Change line 302 from "public CandleStickPatternLogic(NinjaScriptBase ninjaScript, int trendStrength)" to "public CandleStickPatternLogicModified(NinjaScriptBase ninjaScript, int trendStrength)"
          From here, you may paste in the additional logic that you have added.

          When it comes to accessing a property, such as lastBullIndex, from the indicator class, you could copy what the CandleStickPatternLogic already does for trendStrength:
          Code:
                  public CandleStickPatternLogic(NinjaScriptBase ninjaScript, int trendStrength)
                  {
                      this.ninjaScript    = ninjaScript;
                      this.trendStrength    = trendStrength;
                  }​
          You will also need to make the variable a public property in the Properties section of the indicator.

          I appreciate your time and patience.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          602 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          347 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          560 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          559 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X