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 love2code2trade, Yesterday, 01:45 PM
        4 responses
        28 views
        0 likes
        Last Post love2code2trade  
        Started by funk10101, Today, 09:43 PM
        0 responses
        7 views
        0 likes
        Last Post funk10101  
        Started by pkefal, 04-11-2024, 07:39 AM
        11 responses
        37 views
        0 likes
        Last Post jeronymite  
        Started by bill2023, Yesterday, 08:51 AM
        8 responses
        44 views
        0 likes
        Last Post bill2023  
        Started by yertle, Today, 08:38 AM
        6 responses
        26 views
        0 likes
        Last Post ryjoga
        by ryjoga
         
        Working...
        X