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

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 Gerik, Today, 09:40 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by RookieTrader, Today, 09:37 AM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by alifarahani, Today, 09:40 AM
      0 responses
      5 views
      0 likes
      Last Post alifarahani  
      Started by KennyK, 05-29-2017, 02:02 AM
      3 responses
      1,285 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by AttiM, 02-14-2024, 05:20 PM
      11 responses
      186 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X