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

I think I broke it!

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

    I think I broke it!

    I am trying to get an indicator to plot down into the 2nd panel. I just need this on panel two. http://screencast.com/t/11DSw0azGAYf

    This may sound like a simple task however the indicator already is drawing some invisible objects on the screen to get these Dots. So I can't attached it to my panel two because I'm drawn them through a list of a class created and called by the indicator.

    So then I went and referenced all my variables to another indicator which I couldn't get to work and make the reference calls due to it saying
    Code:
    indicator.name new reference;
    in my variables was a method being used like a type.
    So then I tried to link the list of a class to a strategy. I got that to work but it had a HEART ATTACK when I applied it to my charts.


    Code:
    namespace NinjaTrader.Strategy
    {
        /// <summary>
        /// plots horizons
        /// </summary>
        [Description("plots horizons")]
        public class APAhorizonplots : Strategy
        {
    		#region Variables
           	Indicator.APAHorizon horizon;
    		
    		public int strength = 4;
    		public int dz = 3;
    		
    		//public List<APAHorizon.confluencetime> Master;
    		
    		
            #endregion
    		
             protected override void Initialize()
            {
               // Master = new List<APAHorizon.confluencetime>();
               
    			horizon = APAHorizon(dz, strength);
                            
    			
    			
            }
    		 protected override void OnStartUp()
            {
    		 	horizon.Input = BarsArray[0];
    			
    		}
           
           protected override void OnBarUpdate()
            {
    				//brings over the list class from the indicator
    				List<APAHorizon.confluencetime> DisplayML = horizon.GetMasterSortedlist();  
    				APAHorizon.confluencetime DisplayMasterPlot = horizon.GetLastMasterSortedlist();  
    				
    				//checks for null
    				if(DisplayMasterPlot == null)
    				{
    					Print("Take Off you hoser");
    					return;
    				}
    				else
    				{
    					foreach(APAHorizon.confluencetime row in DisplayML)
    					{
    										
    						Print("MasterList:  Time "+row.day+" total count : "+row.count);
    						Font labelFont = new Font("Arial", 8.0f, FontStyle.Bold);
    						Color cc = Getconfluencecolor(row.count);
    						
    						DrawDot("futureplot"+row.day, true, row.day, Close[0], cc);
    						DrawText("Date of Instance"+row.day,true, ""+row.day.ToShortDateString(), row.day, 0,0, cc, labelFont ,StringAlignment.Center, Color.Transparent, Color.Transparent,0);
    					}
    //				}
    			
    		}
        private Color Getconfluencecolor(int count)
    		{
    			switch(count)
    						{
    							case 0:
    								return Color.Blue;
    							
    							case 1:
    								return Color.Orange;
    															
    							case 2:
    								return Color.Red;
    								
    							case 3:
    								return Color.Green;
    							
    							case 4:
    								return Color.Black;
    								
    						}
    					return Color.Turquoise;
    		}
    Anyone have a clue how to get this to work?
    Last edited by APA Zones; 07-17-2012, 10:05 PM.

    #2
    Slow down, take a deep breath...

    Is this a runtime or compile time error?

    I'm going to guess runtime. I've never heard of APAxxxxxxxxxx...?

    I've google'd 5 lines of you code and can't find anything related to APA horizon...ummm




    Originally posted by doubletop View Post
    I am trying to get an indicator to plot down into the 2nd panel. I just need this on panel two. http://screencast.com/t/11DSw0azGAYf

    This may sound like a simple task however the indicator already is drawing some invisible objects on the screen to get these Dots. So I can't attached it to my panel two because I'm drawn them through a list of a class created and called by the indicator.

    So then I went and referenced all my variables to another indicator which I couldn't get to work and make the reference calls due to it saying
    Code:
    indicator.name new reference;
    in my variables was a method being used like a type.
    So then I tried to link the list of a class to a strategy. I got that to work but it had a HEART ATTACK when I applied it to my charts.


    Code:
    namespace NinjaTrader.Strategy
    {
        /// <summary>
        /// plots horizons
        /// </summary>
        [Description("plots horizons")]
        public class APAhorizonplots : Strategy
        {
            #region Variables
               Indicator.APAHorizon horizon;
            
            public int strength = 4;
            public int dz = 3;
            
            //public List<APAHorizon.confluencetime> Master;
            
            
            #endregion
            
             protected override void Initialize()
            {
               // Master = new List<APAHorizon.confluencetime>();
               
                horizon = APAHorizon(dz, strength);
                            
                
                
            }
             protected override void OnStartUp()
            {
                 horizon.Input = BarsArray[0];
                
            }
           
           protected override void OnBarUpdate()
            {
                    //brings over the list class from the indicator
                    List<APAHorizon.confluencetime> DisplayML = horizon.GetMasterSortedlist();  
                    APAHorizon.confluencetime DisplayMasterPlot = horizon.GetLastMasterSortedlist();  
                    
                    //checks for null
                    if(DisplayMasterPlot == null)
                    {
                        Print("Take Off you hoser");
                        return;
                    }
                    else
                    {
                        foreach(APAHorizon.confluencetime row in DisplayML)
                        {
                                            
                            Print("MasterList:  Time "+row.day+" total count : "+row.count);
                            Font labelFont = new Font("Arial", 8.0f, FontStyle.Bold);
                            Color cc = Getconfluencecolor(row.count);
                            
                            DrawDot("futureplot"+row.day, true, row.day, Close[0], cc);
                            DrawText("Date of Instance"+row.day,true, ""+row.day.ToShortDateString(), row.day, 0,0, cc, labelFont ,StringAlignment.Center, Color.Transparent, Color.Transparent,0);
                        }
    //                }
                
            }
        private Color Getconfluencecolor(int count)
            {
                switch(count)
                            {
                                case 0:
                                    return Color.Blue;
                                
                                case 1:
                                    return Color.Orange;
                                                                
                                case 2:
                                    return Color.Red;
                                    
                                case 3:
                                    return Color.Green;
                                
                                case 4:
                                    return Color.Black;
                                    
                            }
                        return Color.Turquoise;
            }
    Anyone have a clue how to get this to work?

    Comment


      #3
      doubletop, I guess I'm not exactly sure what you're trying to do here - you can unfortunately not plot / draw to both panels from one indicator, some users found success though in using DrawOnPricePanel dynamically, however we could officially not support it.

      If you wish to access internal variables or series values of your indicator and those would not be exposed already as plots, please use the concepts of this reference sample :

      BertrandNinjaTrader Customer Service

      Comment


        #4
        Originally posted by sledge View Post
        Slow down, take a deep breath...

        Is this a runtime or compile time error?

        I'm going to guess runtime. I've never heard of APAxxxxxxxxxx...?

        I've google'd 5 lines of you code and can't find anything related to APA horizon...ummm
        You haven't found it because it does not exist yet. Its in Alpha/Beta. APAhorizonplot is the name of the strategy I gave it to plot in the 2nd panel.
        Thanks for the word on people that have hacked this method. I will have to make my own hack I guess. Thanks again.
        Last edited by APA Zones; 07-18-2012, 12:17 PM.

        Comment


          #5
          So I guess you have to break something before you really know what you are doing.
          The DrawOnPricePanel = false in the initialize method worked like a charm and boom I got it to work
          Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by MacDad, 02-25-2024, 11:48 PM
          7 responses
          158 views
          0 likes
          Last Post loganjarosz123  
          Started by Belfortbucks, Today, 09:29 PM
          0 responses
          7 views
          0 likes
          Last Post Belfortbucks  
          Started by zstheorist, Today, 07:52 PM
          0 responses
          7 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          151 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Started by mattbsea, Today, 05:44 PM
          0 responses
          6 views
          0 likes
          Last Post mattbsea  
          Working...
          X