PDA

View Full Version : Problems with simple donchian cross test


zoltran
04-02-2007, 08:06 AM
I'm testing some simple strategies and am stumped on what I assume to be a dumb user error.
The test I'm trying right now is to just plot an arrow when High is above the prior bars upper donchian channel. I've also tried doing this as a crossup.
Neither one seems to trigger.
I'd appreciate it if you can take a gander.. probably just needs a fresh set of eyes




--------- Sample 1 --------
protected override void Initialize()
{
Add(DonchianChannel(DonchianPeriods));
CalculateOnBarClose = false;
}
protected override void OnBarUpdate()
{
// Condition set 1
if (High[0] > DonchianChannel(DonchianPeriods).Upper[1])
{
DrawArrowUp("My up arrow" + CurrentBar, 0, 0, Color.Lime);
}
}

--------------Sample 2 Signal on cross over upper channel -----------------
protected override void Initialize()
{
Add(DonchianChannel(DonchianPeriods));
CalculateOnBarClose = false;
}

protected override void OnBarUpdate()
{
// Condition set 1
if (CrossAbove(High, DonchianChannel(DonchianPeriods).Upper, 1))
{
DrawArrowUp("My up arrow" + CurrentBar, 0, 0, Color.Lime);
}
}

NinjaTrader_Ray
04-02-2007, 08:30 AM
You are passing in "0" for the y co-ordinate of the arrow plot. Try:

DrawArrowUp("My up arrow" + CurrentBar, 0, Low[0] - TickSize, Color.Lime);


Ray

zoltran
04-02-2007, 10:21 AM
Thank you Ray