Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BUY and HOLD strategy

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

    BUY and HOLD strategy

    Hi Members,

    I'm new to Ninja Trader but have experience trading. I created a Strategy in the New Strategy Builder and would like to please learn what to input in the "Conditions and Actions" window to create a simple Buy and Hold strategy to compare against other Strategies that (of course) are NOT buy and hold.

    I'm sure this topic has been beaten to death but appreciate the help.

    I understand I'm suppose to use something called OnBarUpdate() and ExitOnClose = true but not sure how to arrive at this using the New Strategy Builder. I've built strategies before using the New Strategy Builder but was wondering if I can create a new strategy called Buy and Hold.

    I'm learning C# programming language and have not coded directly using Ninja Script but will be there shortly. I'd rather understand what I'm doing as oppose to just receiving the programming code and running it.

    Please walk me through this as replies such as the one below are most likely correct but vague and intimidating to me right now as I am still new to programming. For example, where would I place this code? In the Ninja Script section or in the New Strategy Builder English version?

    -start-

    protected override void OnBarUpdate()
    {
    if (CurrentBar == 1)
    {
    EnterLong(DefaultQuantity, "BuyAndHold");
    }
    }

    -end

    I've been using other Backtesting Software in the past and NinjaTrader has the most comprehensive Strategy Builder that uses plain English and their support is second to none. I understand I can view the ninja code underneath the English version of "Conditions and Actions".

    Appreciate the patience in reading my post

    Stay well

    #2
    Helicopter, welcome to our forums! The code snippet you posted should do it, please see my attached file, bars required would also have to be set to 0 and ExitOnClose disabled, then use the Strategy Analyzer to test.
    Attached Files
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by mmenigma, Today, 02:22 PM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by frankthearm, Today, 09:08 AM
    9 responses
    35 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by NRITV, Today, 01:15 PM
    2 responses
    9 views
    0 likes
    Last Post NRITV
    by NRITV
     
    Started by maybeimnotrader, Yesterday, 05:46 PM
    5 responses
    26 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by quantismo, Yesterday, 05:13 PM
    2 responses
    21 views
    0 likes
    Last Post quantismo  
    Working...
    X