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 popecapllc, 08-09-2023, 07:42 PM
    8 responses
    1,343 views
    0 likes
    Last Post Johng22
    by Johng22
     
    Started by ETFVoyageur, 04-30-2024, 02:04 PM
    11 responses
    100 views
    0 likes
    Last Post ETFVoyageur  
    Started by bubblegum, 03-18-2024, 10:41 AM
    3 responses
    44 views
    0 likes
    Last Post vjsworld  
    Started by JamesK1, Today, 02:48 PM
    1 response
    13 views
    0 likes
    Last Post JamesK1
    by JamesK1
     
    Started by llanqui, Today, 03:51 PM
    0 responses
    11 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Working...
    X