I'm trying to get value from my custom indicator into my strategy.
I can access to plot value without problem using another indicator (like SMA(), VOL(), ecc), but if I try to access to these variables like below i can't.
Variables check1, check2, check3 and trendS are public in my custom indicator, so i have not compiling problem.
but if I Print this values they are wrong., whie in my indicator are correct.
I think problem is that this 4 variables aren't Plot[] Values in my indicator, this doesn't plot any Values[], just do some calculations and render some line
How can I access to these variables?
thank you, best regards
AndreaConato
namespace NinjaTrader.NinjaScript.Strategies
{
public class TestRitracciamento : Strategy
{
// Variables
ACRItracciamentoCompleto4 myRitracciamento;
bool controllo1 = false;
bool controllo2 = false;
bool controllo3 = false;
int trendLungo = 0;
int RitracciamentoS = 0;
int RitracciamentoF = 0;
double RiskReward = 0;
double RitracciamentoMin = 0;
double RitracciamentoMax = 0;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = "TestRitracciamento";
Name = "TestRitracciamento";
Calculate = Calculate.OnPriceChange;
RitracciamentoS = 10;
RitracciamentoF = 5;
RiskReward = 2;
RitracciamentoMin = 50;
RitracciamentoMax = 90;
}
else if (State == State.DataLoaded)
{
myRitracciamento = ACRItracciamentoCompleto4(RitracciamentoS,Ritracci amentoF,RiskReward,RitracciamentoMin,Ritracciament oMax);
}
}
protected override void OnBarUpdate()
{
if (CurrentBar < BarsRequiredToTrade)
return;
controllo1 = myRitracciamento.check1;
controllo2 = myRitracciamento.check2;
controllo3 = myRitracciamento.check3;
trendLungo = myRitracciamento.trendS;
Print("" + controllo1 + controllo2 + controllo3 + trendLungo);
}
}
}

Comment