Hi Henry MultiCharts,
In your post: viewtopic.php?f=19&t=45848#p100792
you mention a way to calculate a function on data2:
To make the function calculated on data2. Example for ADX function:
Code: ADX _a = new ADX(this,2);
I have spent many hours trying to implement this and get it to work. Can you please give me an example of how to do this.
Thanks, Mark
Reference function on data2 [SOLVED]
Re: Reference function on data2 [SOLVED]
No need to reply; I finally figured it out. Here is an example of an indicator that calculates the raw MACD on data2:
Code: Select all
...
public class MACD_MTF : IndicatorObject
{
private Function.MACD m_macd2;
...
protected override void Create() {
m_macd2 = new Function.MACD(this,2);
}
protected override void StartCalc() {
m_macd2.Price = Bars.Close;
m_macd2.FastLength = 12;
m_macd2.SlowLength = 26;
}
protected override void CalcBar(){
Output.WriteLine("Close2: {0}, MACD2: {1}", BarsOfData(2).Bars.Close[0].ToString(), m_macd2[0] + System.Environment.NewLine);
}
}