Im declaring a class in userdefinedmethods.cs for strategies that is this one:
public class Candle:Strategy
{
//Atributos
private double size;
private double bodysize;
private int direction;
private double uppershadowsize;
private double lowershadowsize;
private double shadowsize;
private double percentagebody;
private double percentageshadow;
//Metodos
// Direction: Devuelve +1 la vela es Bullish, 0 si es Neutra, -1 si es Bearish
public int Direction(int vela)
{
if (Open[vela]>Close[vela])
{
direction=-1;
return -1;
}
if (Open[vela]==Close[vela])
{
direction=0;
return 0;
}
if (Open[vela]<Close[vela])
{
direction=0;
return 1;
}
return -99;
}//Fin Direction
}//Fin Candle
When I try to access to Direction from an Strategy it will get access to it but it will always return 0, I dont understand why. I know that Open[x] and Close[x] will return 0 everytime. Here is the code for accesing the Method Direction from one strategy:
public class AAA : Strategy
{
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)
#endregion
public Candle C;
public AAA()
{
C=new Candle();
}
protected override void Initialize()
{
CalculateOnBarClose = true;
}
protected override void OnBarUpdate()
{
Print(C.Direction(0));
}
#region Properties
#endregion
}
Someone Could help with this? Im blocked
Belikewater
Comment