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

Refrencing Bar Pattern

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

    Refrencing Bar Pattern

    How would I create a pattern that can be referrenced. For example I define a Doji bar and then be able to reference it has Doji[1] = true for one bar back or Doji[5] =1 for 5 bars back.

    I have

    #region Variables
    private DataSeries myEMA, upperBand, lowerBand, doji;


    protected override void Initialize()
    doji = new DataSeries(this);

    protected override void OnBarUpdate()
    Doji.Set=
    Open[0] == Close[0]
    && High[0] > Open[0]
    && Low[0] < Open[0];

    I keep getting an error, "Can't assign to Set because it is a Method Group"

    How would I do this so that if it is true, i get a value of 1 i.e. true ?

    #2
    Originally posted by velocity View Post
    How would I create a pattern that can be referrenced. For example I define a Doji bar and then be able to reference it has Doji[1] = true for one bar back or Doji[5] =1 for 5 bars back.

    I have

    #region Variables
    private DataSeries myEMA, upperBand, lowerBand, doji;


    protected override void Initialize()
    doji = new DataSeries(this);

    protected override void OnBarUpdate()
    Doji.Set=
    Open[0] == Close[0]
    && High[0] > Open[0]
    && Low[0] < Open[0];

    I keep getting an error, "Can't assign to Set because it is a Method Group"

    How would I do this so that if it is true, i get a value of 1 i.e. true ?
    1. DataSeries must contain double values.
    2. you might want to use boolseries.

    #region Variables
    private BoolSeries doji;


    protected override void Initialize()
    doji = new BoolSeries(this);

    protected override void OnBarUpdate()
    doji.Set(Open[0] == Close[0] && High[0] > Open[0] && Low[0] < Open[0]);

    Comment


      #3
      Thanks for your help roonius!

      Here's a link to the BoolSeries Class - http://www.ninjatrader-support.com/H...riesClass.html
      BertrandNinjaTrader Customer Service

      Comment


        #4
        roonius,

        Thanks for all the help. I will give it a try. and thanks for the post Bertrand.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kempotrader, Today, 08:54 AM
        0 responses
        1 view
        0 likes
        Last Post kempotrader  
        Started by mmenigma, Today, 08:54 AM
        0 responses
        1 view
        0 likes
        Last Post mmenigma  
        Started by halgo_boulder, Today, 08:44 AM
        0 responses
        1 view
        0 likes
        Last Post halgo_boulder  
        Started by drewski1980, Today, 08:24 AM
        0 responses
        3 views
        0 likes
        Last Post drewski1980  
        Started by rdtdale, Yesterday, 01:02 PM
        2 responses
        17 views
        0 likes
        Last Post rdtdale
        by rdtdale
         
        Working...
        X