Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IDrawTool

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

    IDrawTool

    In NinjaTrader 7 I had the following code

    foreach(IDrawObject draw in DrawObjects)
    {
    if(draw.Tag == xxx)
    {
    Do Stuff
    }
    }

    What would be the equivalent in NinjaTrader 8 ?

    Thank you !

    #2
    Originally posted by blar58 View Post
    What would be the equivalent in NinjaTrader 8 ?

    Replace IDrawObject with DrawingTool ..


    -=Edge=-
    NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

    Comment


      #3
      casting DrawingTool object

      foreach(DrawingTool draw in DrawObjects)
      {
      if(draw.Tag == "RegressionChannel")
      {
      RegressionChannel regression = (RegressionChannel)draw;
      if(regression.EndY > regression.StartY)
      {
      regressionIsRising = true;
      regressionIsFalling = false;
      }
      else
      if(regression.EndY < regression.StartY)
      {
      regressionIsRising = false;
      regressionIsFalling = true;
      }
      }
      }

      Sorry part of the code was missing. My problem is really with casting the DrawingTool object as RegressionChannel

      Comment


        #4
        Originally posted by blar58 View Post
        Sorry part of the code was missing. My problem is really with casting the DrawingTool object as RegressionChannel
        NinjaTrader.NinjaScript.DrawingTools.RegressionChannel


        -=Edge=-
        NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

        Comment


          #5
          Hello blar58,

          Please let me know if you require further assistance.

          Thank you -=Edge=- for your insight.
          Michael M.NinjaTrader Quality Assurance

          Comment


            #6
            yes Michael I still can't get my method working

            Comment


              #7
              here is the method :
              EndAnchor.Price and StartAnchor.Price = 0
              Code:
              foreach(DrawingTool draw in DrawObjects)
              {
              				
                    if(draw.Tag == "RegressionChannel"+sessionCount)
                    {
                        NinjaTrader.NinjaScript.DrawingTools.RegressionChannel regression =       (NinjaTrader.NinjaScript.DrawingTools.RegressionChannel)draw;
              					
              if(regression.EndAnchor.Price > regression.StartAnchor.Price)
              {
                           regressionIsRising = true;
                           regressionIsFalling = false;
              }
              else
              if(regression.EndAnchor.Price < regression.StartAnchor.Price)
              {
              	regressionIsRising = false;
              	regressionIsFalling = true;
              }	
              }
              			}
              Last edited by blar58; 09-30-2015, 02:14 PM.

              Comment


                #8
                I am still stucked because this method not working.
                I am just trying to know if the RegressionChannel is rising or falling.
                I could do it with NT7.

                Need help

                Comment


                  #9
                  Hello blar58,

                  Thank you for your patience. I was able to get this working using the following:
                  Code:
                  foreach(DrawingTool draw in DrawObjects){
                      if(draw is NinjaTrader.NinjaScript.DrawingTools.RegressionChannel){
                          NinjaTrader.NinjaScript.DrawingTools.RegressionChannel regression = draw as NinjaTrader.NinjaScript.DrawingTools.RegressionChannel;
                          Print(regression.StartAnchor.Price);
                          Print(regression.EndAnchor.Price);
                      }
                  }
                  Please let me know if I may be of further assistance.
                  Michael M.NinjaTrader Quality Assurance

                  Comment


                    #10
                    Thank you for your reply Michael.

                    I still get the same problem. Price is 0.
                    However StartAnchor. BarsAgo and EndAnchor.BarsAgo work fine.
                    Only StartAnchor.Price and EndAnchor.Price don't work.

                    I use the Draw.RegessionChannel from OnBarUpdate().

                    I even tried to simplify the whole process and went this way :
                    Code:
                    NinjaTrader.NinjaScript.DrawingTools.RegressionChannel regression = Draw.RegressionChannel(this,"RegressionChannel"+sessionCount, false, 11, 1, Brushes.Blue, DashStyleHelper.Solid, 1, Brushes.Gray, DashStyleHelper.Solid, 1, Brushes.Blue, DashStyleHelper.Solid, 1); 
                    							
                    Print(" Start : "+regression.StartAnchor.Price);
                    Print("End:"+regression.EndAnchor.Price);
                    
                    I get 0 !
                    Last edited by blar58; 10-04-2015, 09:22 PM.

                    Comment


                      #11
                      Hello blar58,

                      I have confirmed this behavior and submitted this a bug report for NinjaTrader 8. I will update this thread when I have more information (although it may be a few days or more).

                      Thank you for your continued patience in the meantime.
                      Last edited by NinjaTrader_MichaelM; 10-06-2015, 09:24 AM.
                      Michael M.NinjaTrader Quality Assurance

                      Comment


                        #12
                        OK

                        Thank you Michael

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Max238, Today, 01:28 AM
                        2 responses
                        26 views
                        0 likes
                        Last Post NinjaTrader_ChristopherJ  
                        Started by Shansen, 08-30-2019, 10:18 PM
                        25 responses
                        949 views
                        0 likes
                        Last Post NinjaTrader_BrandonH  
                        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
                        4 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
                         
                        Working...
                        X