Asia
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800
|
Hey All,
Having some coding trouble and hoping the community can help before market open tommorow. In one of my strategies, I use Eco2New2 as a filter. The value of Main[0] must be above, say +5 or below -5 to allow a trade. It works long, it doesn't work short.
In region Variables I have this:
...
privateint eco2New2strength = 5; // Default setting for Eco2New2strength
privateint eco2New2strengthneg = -5; // Default setting for Eco2New2strengthneg
...
In my strat (OnBarUpdate) I have this:
...
&& ((ECO2New2(Eco2New2fast, Eco2New2signal, Eco2New2slow).Main[0]>= Eco2New2strength) || (ECO2New2(Eco2New2fast, Eco2New2signal, Eco2New2slow).Main[0] <= Eco2New2strengthneg))
&& ((ECO2New2(Eco2New2fast, Eco2New2signal, Eco2New2slow).Main[1]>= Eco2New2strength) || (ECO2New2(Eco2New2fast, Eco2New2signal, Eco2New2slow).Main[1] <= Eco2New2strengthneg))
...
Where I am trying to look at Eco2New2.Main[0] and [1] can create a condition where those values need to be above 5 OR below -5.
In the Properties region I have this:
[Description("")]
[Category("Parameters")]
publicint Eco2New2strength
{
get { return eco2New2strength; }
set { eco2New2strength = Math.Max(1, value); }
}
[Description("")]
[Category("Parameters")]
publicint Eco2New2strengthneg
{
get { return eco2New2strengthneg; }
set { eco2New2strengthneg = value; }
}
Long... I'm good. Its not taking shorts, though, since I realized a coding error and introduced a negative for the variable eco2new2strengthneg.
Any obvious error in my code? Thanks for your time...
|