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 CortexZenUSA, Today, 12:53 AM
    0 responses
    1 view
    0 likes
    Last Post CortexZenUSA  
    Started by CortexZenUSA, Today, 12:46 AM
    0 responses
    1 view
    0 likes
    Last Post CortexZenUSA  
    Started by usazencortex, Today, 12:43 AM
    0 responses
    5 views
    0 likes
    Last Post usazencortex  
    Started by sidlercom80, 10-28-2023, 08:49 AM
    168 responses
    2,266 views
    0 likes
    Last Post sidlercom80  
    Started by Barry Milan, Yesterday, 10:35 PM
    3 responses
    13 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X