Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NBarsUP Strategy development.

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

    NBarsUP Strategy development.

    Dear Sir or Madam,

    First of all thank you for your Help,
    I want to inform you that I find a bit difficult to develop this line of strategy using the attached indicator. The objective is to enter a buy/Sell conditions after the Nbarsup Trigger is shown. So if I can draw an arrow means I can add conditions of buy and sell..
    I tried this Line:
    Method A:
    if (NBarsUp(3, true, true, true)[0] == BarsSinceExit())
    {
    DrawArrowUp("MyArrowUp"+CurrentBar, 0, Low[0], Color.Yellow);
    EnterLong(DefaultQuantity,"Buy");
    }

    Method B:
    if (NBarsUp(3, true, true, true)[0] == Close[0])
    {
    DrawArrowUp("MyArrowUp"+CurrentBar, 0, Low[0], Color.Yellow);
    EnterLong(DefaultQuantity,"Buy");
    }

    Please can you help me with this, What is the mistake that I am doing?

    Thank you a lot,
    Attached Files

    #2
    Hello Yassine.Chetouani,

    What is the behavior that you are expecting?

    What is the behavior that is incorrect?

    Are you receiving a compile error?

    Are you receiving an error in the Log tab of the Control Center when running the script ?


    As a heads up, the first condition would require another condition to make the initial order. BarsSinceExit() will return -1 if there has not been an exit. NBarsUp will always return 0 or higher. This means this condition will never place the initial order, if there hasn't been at least one exit (and entry) this condition will not be true.

    The second condition is comparing NBarsUp which returns the number of consecutive up bars previous to the current up bar to the current price of the current bar.
    Unless the data series is returning a very low value in the single digits, this condition is unlikely to be true.

    NBarsUp() - http://ninjatrader.com/support/helpG.../n_bars_up.htm
    BarsSinceExit() - http://ninjatrader.com/support/helpG...ssinceexit.htm
    Close - http://ninjatrader.com/support/helpGuides/nt7/close.htm
    Last edited by NinjaTrader_ChelseaB; 08-31-2016, 07:32 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Dear ChelseaB

      Thank you so much for answering my request.
      I want to inform you that I received my answer from your previous mail.
      actually this link provided me with all the necessary information and a better idea on my error.
      NBarsUp() - http://ninjatrader.com/support/helpG.../n_bars_up.htm
      I don't know how I missed it. thank you again.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      646 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      367 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      107 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      569 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X