Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Sample Buy and Hold Strategy

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

    Sample Buy and Hold Strategy

    I know it is trivial to write it on your own, but I would still suggest including a simple buy and hold strategy as a NT 7 example strategy. The reason is so you can easily compare an active long/short strategy on a stock with a passive buy and hold approach, etc.

    The code would be very simple but something like this:

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

    #2
    Thanks for the suggestion Anagoge!
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by f.saeidi, Today, 01:38 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by FAQtrader, Today, 12:00 PM
    3 responses
    14 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by benmarkal, Today, 12:52 PM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by frankthearm, 04-18-2024, 09:08 AM
    15 responses
    63 views
    0 likes
    Last Post frankthearm  
    Started by habeebft, Today, 01:18 PM
    0 responses
    2 views
    0 likes
    Last Post habeebft  
    Working...
    X