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

bar type

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

    bar type

    Hello,
    Im new to Ninja trader having used pro real time for a couple of years.
    I have some basic programming knowlege but am struggling to get started with Ninja.
    I am wanting to create a couple of indicators that identify cetain types of bars. The first being a bar that opens in the bottom third and then closes in the bottom third... what would be the best way to make a start on this?
    Thanks for any help.

    #2
    This is as far as i have got... would there be a simpler way?

    Code:
               /// <summary>
            /// This method is used to configure the indicator and is called once before any bar data is loaded.
            /// </summary>
            protected override void Initialize()
            {
                
                CalculateOnBarClose    = true;
                Overlay                = true;
                PriceTypeSupported    = false;
                upcolor = Color.Red;
                insidebar            =    new DataSeries(this);
                soundon = false;
                
                
            }
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
                if (CurrentBar < 4) return;
                
                 range1 = Math.Abs(High[0]-Low[0]);
                third = Math.Abs(range1/3);
                TopThird = Low[0]+third+third ;
                MidThirdLow = Low[0]+third ;
                MidThirdHigh = High[0]-third ;
                BottomThird = High[0]-third-third ;
    
            // Check for InsideBar pattern
                    
                if(
                Open[0] > MidThirdLow 
                    && Open[0] < MidThirdHigh 
                    && Close[0] > MidThirdHigh
                    )    
                    
                {
                    BarColor = upcolor;
                    insidebar.Set(1);
                    if(soundon)
                        {
                            if (!Historical)
                                PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\Alert4.wav");
                        }
                }
                else
                    insidebar.Set(0);
            }
    Last edited by tradingcube; 11-07-2008, 11:13 AM.

    Comment


      #3
      Hi tradingcube,

      Welcome to our forum!

      You can check out the Narrowest Range Finder post in our sharing section, it has an option to also check for the Inside Bars condition.



      Have a great day!


      Originally posted by tradingcube View Post
      This is as far as i have got... would there be a simpler way?

      Code:
       
                 /// <summary>
              /// This method is used to configure the indicator and is called once before any bar data is loaded.
              /// </summary>
              protected override void Initialize()
              {
       
                  CalculateOnBarClose    = true;
                  Overlay                = true;
                  PriceTypeSupported    = false;
                  upcolor = Color.Red;
                  insidebar            =    new DataSeries(this);
                  soundon = false;
       
       
              }
       
              /// <summary>
              /// Called on each bar update event (incoming tick)
              /// </summary>
              protected override void OnBarUpdate()
              {
                  if (CurrentBar < 4) return;
       
                   range1 = Math.Abs(High[0]-Low[0]);
                  third = Math.Abs(range1/3);
                  TopThird = Low[0]+third+third ;
                  MidThirdLow = Low[0]+third ;
                  MidThirdHigh = High[0]-third ;
                  BottomThird = High[0]-third-third ;
       
              // Check for InsideBar pattern
       
                  if(
                  Open[0] > MidThirdLow 
                      && Open[0] < MidThirdHigh 
                      && Close[0] > MidThirdHigh
                      )    
       
                  {
                      BarColor = upcolor;
                      insidebar.Set(1);
                      if(soundon)
                          {
                              if (!Historical)
                                  PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\Alert4.wav");
                          }
                  }
                  else
                      insidebar.Set(0);
              }
      Last edited by NinjaTrader_Bertrand; 11-07-2008, 12:18 PM.
      BertrandNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by JonesJoker, 04-22-2024, 12:23 PM
      8 responses
      41 views
      0 likes
      Last Post JonesJoker  
      Started by timko, Today, 06:45 AM
      0 responses
      3 views
      0 likes
      Last Post timko
      by timko
       
      Started by Waxavi, 04-19-2024, 02:10 AM
      2 responses
      39 views
      0 likes
      Last Post poeds
      by poeds
       
      Started by chbruno, Yesterday, 04:10 PM
      1 response
      44 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by Max238, Today, 01:28 AM
      1 response
      25 views
      0 likes
      Last Post CactusMan  
      Working...
      X