Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Automated trading

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

    Automated trading

    Good morning all,

    Live working strategy will open positions whenever conditions are met. How it’s possible in NT 8 to make strategy STOP working after opening and closing only one position, so I will put it back on manually after some time. Or just take a break for like 3 minutes and continue work normally after that?
    Thank you
    Michael

    #2
    Hello 2014Michael,

    Thank you for your post.

    It is in fact possible to stop the strategy from trading. Below is a basic example:
    Code:
    		private bool IsTrading = false;
    		protected override void OnStateChange()
    		{
    			if (State == State.SetDefaults)
    			{
    				Name										= "ExampleStopStrategyAfterOneTrade";
    			}
    		}
    
    		protected override void OnBarUpdate()
    		{
    			// Only trade on realtime data
    			// This means no historical trading (backtests) will occur
    			if (State <= State.Historical) return;
    			
    			// check if we have already submitted an entry and if that entry was filled
    			// You can include any exit conditions here
    			if (IsTrading && Position.MarketPosition == MarketPosition.Long)
    			{
    				ExitLong();
    				// We don't set IsTrading back to false here as we want the strategy to stop trading
    				// If you want the strategy to pick up trades later you can use a condition and then set the IsTrading bool to false
    			}
    			// If we are not in a trade and have not taken a trade then place an entry
    			if (!IsTrading)
    			{
    				EnterLong();
    				// Now we set the bool to true to indicate we have placed an entry
    				IsTrading = true;
    			}
    		}
    If you would like to take a look a time filter condition please visit the following links:
    Please let me know if you have any questions.

    Comment


      #3
      Thank you Patrick H. Let my see how it works.
      Sincerely,
      Michael

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      79 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      45 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      29 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      32 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      66 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X