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

BoolSeries

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

    BoolSeries

    I'm using a multi-time frame and BoolSeries and trying to build a strategy.

    Is there any way to say did the BoolSeries trigger within the last ten bars on a different timeframe?

    Example:

    5 minute chart upTrend became true on current bar, look back to see if upTrend became true within the last 10 bars on 15 minute chart.

    Thank you.

    #2
    Hello shawnkm,

    You would need to add the secondary instrument series to your script. Then sync the boolseries with this added secondary series so there is one slot for each secondary series bar in the boolseries.

    Below is a link to an example of this.
    http://ninjatrader.com/support/forum...ead.php?t=3572
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I understand adding the secondary instrument series. And I understand the sync with the boolseries.

      What I dont understand is the code needed to test for true within the last 10 bars... ie. not just 10 bars ago... but was it true for any of the last 10 bars.

      Can you please provide the code needed for this?

      Thank you.

      Comment


        #4
        Hello shawnkm,

        You would need to loop through the last 10 bars and test for a true.

        bool trueFound = false;
        for (i = 0; i < 10; i++)
        {
        if (MyBoolsSeries[i] == true)
        {
        trueFound = true;
        }
        }

        if (trueFound)
        {
        Print("MyBoolSeries contains a true value within the last 10 bars");
        }
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by andrewtrades, Today, 04:57 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by chbruno, Today, 04:10 PM
        0 responses
        6 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Started by josh18955, 03-25-2023, 11:16 AM
        6 responses
        436 views
        0 likes
        Last Post Delerium  
        Started by FAQtrader, Today, 03:35 PM
        0 responses
        8 views
        0 likes
        Last Post FAQtrader  
        Started by rocketman7, Today, 09:41 AM
        5 responses
        19 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X