Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 geddyisodin, Yesterday, 05:20 AM
      8 responses
      51 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by cmtjoancolmenero, Yesterday, 03:58 PM
      10 responses
      36 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by DayTradingDEMON, Today, 09:28 AM
      4 responses
      24 views
      0 likes
      Last Post DayTradingDEMON  
      Started by George21, Today, 10:07 AM
      1 response
      17 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Started by Stanfillirenfro, Today, 07:23 AM
      9 responses
      25 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X