I have two classes in two different files.
One is Caracteristicas that I define a method named TamanioSpread and the other one is HOLA when I try to call this method and I succeed but while the method of Caracticas succesfull prints "test" in the Console he prints 0 as the High of current bar when this obviously is not the price. Could anyone help me why is that?
Also any interesting Link as how to create classes that we are going to use a lot in our Strategy Development?
Thank you
Here are both classes:
#region Using declarations
using ALL the ones that comes with Strategy
#endregion
namespace NinjaTrader.Strategy
{
public class Caracteristicas:Strategy
{
public double TamanioSpread(int vela)
{
Print("test");
Print(High[0]);
return(High[vela]-Low[vela]);
}
}
namespace NinjaTrader.Strategy
{
/// <summary>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class HOLA : Strategy
{
public Caracteristicas h=new Caracteristicas();
protected override void Initialize()
{
CalculateOnBarClose = true;
}
protected override void OnBarUpdate()
{
Print("Esto si que es el High " + High[0]);
h.TamanioSpread(0);
}
#region Properties
[Description("")]
[GridCategory("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
}
}
Comment