Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problems with simple donchian cross test

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Problems with simple donchian cross test

    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);
    }
    }



    #2
    imported post

    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
    RayNinjaTrader Customer Service

    Comment


      #3
      imported post

      Thank you Ray

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      62 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      33 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      44 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      58 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      47 views
      0 likes
      Last Post CarlTrading  
      Working...
      X