NexusFi: Find Your Edge


Home Menu

 





Expose Public Class List


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one TAJTrades with 3 posts (0 thanks)
    2. looks_two sniffy with 2 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 fluxsmith with 1 posts (0 thanks)
    1. trending_up 2,801 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread

Expose Public Class List

  #1 (permalink)
TAJTrades
Here, GA
 
Posts: 158 since Jun 2009
Thanks Given: 1
Thanks Received: 86

Obviously my egotistical, narcissistic beliefs in my coding skills great exceed reality. So could somebody toss me a bone LOL.

I am trying to Expose the List created in the code to other Indicators and Strategies. The code seems to work fine within the indicator and am in fact using it. After spending a few weeks I still have not figured out how to expose it. I am guessing that I need something in the Properties Region and have tried many ideas but no success. Or maybe this is not possible.

 
Code
                            
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
using System.Collections.Generic;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
    
//     Use Indicator Name as Prefix to Class Name
    
public class htcSampleExposePublicList_SampleListClass
    
{
        public 
int SampleInt
        public 
double SampleDouble;
        public 
string SampleString;
        public 
bool SampleBool;
    
        public 
htcSampleExposePublicList_SampleListClass(int SampleIntdouble SampleDoublestring SampleStringbool SampleBool )
        {
            
this.SampleInt SampleInt;
            
this.SampleDouble SampleDouble;
            
this.SampleString SampleString;
            
this.SampleBool SampleBool;
        }
    }    
    

    [
Description("Learn how to Expose a Publis Class List")]
    public class 
htcSampleExposePublicList Indicator
    
{
        
#region Variables
        // User defined variables (add any user defined variables below)
        
public List<htcSampleExposePublicList_SampleListClasssamplelistclass = new List<htcSampleExposePublicList_SampleListClass>();        
        
        
#endregion


        
protected override void Initialize()
        {
            
Overlay                false;
        }

        
/// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        
protected override void OnBarUpdate()
        {
            
//  Criteria to Clear List
            
if (Falling(SMA(20))) 
                
samplelistclass.Clear();
            
            
//  Criteria to Add to List
            
if (Rising(SMA(20))) 
                
samplelistclass.Add(new htcSampleExposePublicList_SampleListClass(0SMA(10)[0], "SMA is Rising"true ));
                
        }

        
#region Properties

            //  What is the Code to Expose "samplelistclass" to other Indicators and Stratagies?
        
        #endregion
    
}

Or maybe there is another solution to the problem that I am not aware of. After all I am not aware of much!

Thanks

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
MC PL editor upgrade
MultiCharts
NexusFi Journal Challenge - May 2024
Feedback and Announcements
Trade idea based off three indicators.
Traders Hideout
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #3 (permalink)
 fluxsmith 
Santa Maria
 
Experience: Advanced
Platform: NinjaTrader, ThinkOrSwim
Broker: Mirus/Zen-Fire
Trading: ES
Posts: 290 since May 2010
Thanks Given: 97
Thanks Received: 322


See if these minor modifications to your posting help (I had to strip stuff you'll have to put back, it said my post was too long):

 
Code
#region Using declarations
...
#endregion
namespace NinjaTrader.Indicator
{
// Use Indicator Name as Prefix to Class Name
publicclass htcSampleExposePublicList_SampleListClass
{
   publicint SampleInt; 
   publicdouble SampleDouble;
   publicstring SampleString;
   publicbool SampleBool;
 
   public htcSampleExposePublicList_SampleListClass(int SampleInt, double SampleDouble, string SampleString, bool SampleBool )
   {
      this.SampleInt = SampleInt;
      this.SampleDouble = SampleDouble;
      this.SampleString = SampleString;
      this.SampleBool = SampleBool;
   }
} 
 
[Description("Learn how to Expose a Publis Class List")]
publicclass htcSampleExposePublicList : Indicator
{
#region Variables
   // User defined variables (add any user defined variables below)
   public List<htcSampleExposePublicList_SampleListClass> samplelistclass { 
      get { return samplelistclass; } 
      set { samplelistclass = value; }
   }
 
#endregion
 
   protectedoverridevoid Initialize()
   {
      samplelistclass = new List<htcSampleExposePublicList_SampleListClass>();
      Overlay = false;
   }
   ///<summary>
   /// Called on each bar update event (incoming tick)
   ///</summary>
   protectedoverridevoid OnBarUpdate()
   {
      // Criteria to Clear List
      if (Falling(SMA(20))) 
         samplelistclass.Clear();
 
      // Criteria to Add to List
      if (Rising(SMA(20))) 
         samplelistclass.Add(new htcSampleExposePublicList_SampleListClass(0, SMA(10)[0], "SMA is Rising", true ));
 
   }
#region Properties
// What is the Code to Expose "samplelistclass" to other Indicators and Stratagies?

#endregion
}
 
publicclass test {
   public test() {
      htcSampleExposePublicList test = new htcSampleExposePublicList();
      List<htcSampleExposePublicList_SampleListClass> list = test.samplelistclass;
   }
}
} 
#region NinjaScript generated code. Neither change nor remove.
...
#endregion

Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
TAJTrades
Here, GA
 
Posts: 158 since Jun 2009
Thanks Given: 1
Thanks Received: 86

Many thanks fluxsmith. Will give it try after the markets close today.

Reply With Quote
  #5 (permalink)
TAJTrades
Here, GA
 
Posts: 158 since Jun 2009
Thanks Given: 1
Thanks Received: 86

No luck retrieving the information from the List.

Maybe I am going about this the wrong way. Here is the scenario that I am trying to accomplish:

Lets say that I have Exposed DataSeries, IntSeries, BoolSeries that are passing information to other Indicators. Now these Series are basically Empty or set to a value that indicates they are meaningless on 90% of the bars. Seems like a waste of computer resources to me. Therefore I was trying to use a List and then populate the List only when there exists meaningful information.

As an example think of Stochastics Bullishish Divergence on a 60 Minute Chart.
IntSeries : Initial Low Bar
DataSeries: Initial Low Price
DataSeries: Initial Low Indicator Value
IntSeries : Divergence Count
DataSeries: Divergence Low Price
DataSeries: Divergence Low Indicator Value

Using a bunch of Series I can access the 60 Minute Chart Divergence information on a 5 Minute chart. Price must make a Lower Low while keeping a Higher Stochastics Value off the Initial Low Bar on the 60 Minute Chart to create a Divergence Pattern.

Now I am thinking that is a waste of Series (Computer Resources) when most of the time the values are set to "0". Would I not be better off creating a List and having that List Exposed in a similar manner as any any Exposed Series?

Anyone have any suggestions.

Reply With Quote
  #6 (permalink)
sniffy
alask
 
Posts: 7 since Oct 2009
Thanks Given: 0
Thanks Received: 5

hi,

did you ever solve this ?

thanks

Reply With Quote
  #7 (permalink)
sniffy
alask
 
Posts: 7 since Oct 2009
Thanks Given: 0
Thanks Received: 5

Hi

did you ever manage to solve this?

thanks

Reply With Quote




Last Updated on January 6, 2013


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts