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 cls71, Today, 04:45 AM
        0 responses
        1 view
        0 likes
        Last Post cls71
        by cls71
         
        Started by mjairg, 07-20-2023, 11:57 PM
        3 responses
        213 views
        1 like
        Last Post PaulMohn  
        Started by TheWhiteDragon, 01-21-2019, 12:44 PM
        4 responses
        544 views
        0 likes
        Last Post PaulMohn  
        Started by GLFX005, Today, 03:23 AM
        0 responses
        3 views
        0 likes
        Last Post GLFX005
        by GLFX005
         
        Started by XXtrader, Yesterday, 11:30 PM
        2 responses
        12 views
        0 likes
        Last Post XXtrader  
        Working...
        X