there has to be an easier way to close a trade after n bars than what i'm failing to do (string manipulation of datetime variable). how do i achieve this?
How to close trade in Metatrader after amount of time or bars 30 replies
Tick Bars and/or Range bars 5 replies
Default How to close trade in Metatrader after amount of time or amount of bars 5 replies
Small help with the code to count up-bars and down-bars 12 replies
Inside bars vs pin bars 3 replies
DislikedI subtract the rounded opening time from the current bar time and divide by the period multiplied by 60 seconds. So this gives the difference in seconds divided by the number of seconds in the bar. Simplified example: 1200/5*60 = 4. The key is in the rounding - whether to round up to the next period or down to the bar it was on.Ignored