Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

exit trade

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

    exit trade

    how to
    exit a trade on the last bar of session after remaining two days in a trade.
    i am using multitimeframe with primary timeframe being 500 ticks and secondary series is of daily bars.
    please advise

    #2
    Hello easyfying,

    Thank you for your post.

    While we can check how many days have passed since the entry, we would not be able to know which bar is the last bar of a session using a tick based bar as it's timestamp is for the end of bar and that end is unknown until it occurs.

    Below is an example to show how to check when two days have passed since entry:
    Code:
            #region Variables
    		private DateTime dateOfEntry;
            #endregion
    		
            protected override void Initialize()
            {
    			
            }
    		
            protected override void OnBarUpdate()
            {
    			if(myCondition)
    			{
    				EnterLong();
    				dateOfEntry = Time[0].Date;
    			}
    			
    			if(Time[0].Date >= Time[0].Date.AddDays(2))
    			{
    				ExitLong();
    			}
            }

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    633 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    364 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    567 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X