For instance, here's a snippet from a simple Indicator that marks bar reversal highs and lows and draws lines between them. The code adds the end points of each line, and some date information to a list of price swings ("swingList), which is a TradingList : List<T>. It then draws lines between the end point of the previous swing and the end point of the latest swing. This works fine.
...
if( reversalList.Count > 1 ) {
JimsSupportFuncs.ReversalBar rbEarlier = (JimsSupportFuncs.ReversalBar) reversalList.ElemAt(1);
JimsSupportFuncs.ReversalBar rbLater = (JimsSupportFuncs.ReversalBar) reversalList.ElemAt(0);
if( rbEarlier.isHighOrLow() == IS_LOW ) {
JimsSupportFuncs.PriceSwing prs = new JimsSupportFuncs.PriceSwing( rbEarlier.getCurrentBar(), rbLater.getCurrentBar(), rbEarlier.getBarTime(), rbLater.getBarTime(), rbEarlier.getLow(), rbLater.getHigh() );
swingList.LimitedAdd(prs);
Draw.Line( this, "SwingLine"+CurrentBar, CurrentBar-((JimsSupportFuncs.PriceSwing)swingList.ElemAt(0)) .getStartCurrentBar(), ((JimsSupportFuncs.PriceSwing)swingList.ElemAt(0)) .getStartPrice(), CurrentBar-((JimsSupportFuncs.PriceSwing)swingList.ElemAt(0)) .getEndCurrentBar(), ((JimsSupportFuncs.PriceSwing)swingList.ElemAt(0)) .getEndPrice(), Brushes.Cyan);
}
}
...
I attempt to make swingList available to other Indicators that might instantiate the SwingFinder Indicator, as follows:
#region Properties
...
[Browsable(false)]
[XmlIgnore]
public JimsSupportFuncs.TradingList<JimsSupportFuncs.Pric eSwing> SwingList
{
get { return swingList; }
}
...
#endregion
When I attempt to retrieve swingList, I get "something", a TradingList of type PriceSwing, but it always has a Count of 0.
...
JimsSupportFuncs.TradingList<JimsSupportFuncs.Pric eSwing> swTest = swings.SwingList; // Always has a count of 0
...
Any thoughts on how I can resolve this would be greatly appreciated.
Comment