Need help counting consecutive profit orders and then resetting count after (x) amount of trades - page 2

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Sorry but they don't . . . . you need better test data and you will see they don't . . unless you have a different definition of consecutive ?
I know where you are coming from. Because, if there is a losing trade inbetween, the count still continues, so therefore they are not "consecutive". Hence, that is why I asked if anyone can help me to add a few lines of code that will reset the current count if there is a loss trade. Been trying all morning/afternoon but to no avail, cannot get the count to reset after a loss. Can you help?
I know where you are coming from. Because, if there is a losing trade inbetween, the count still continues, so therefore they are not "consecutive". Hence, that is why I asked if anyone can help me to add a few lines of code that will reset the current count if there is a loss trade. Been trying all morning/afternoon but to no avail, cannot get the count to reset after a loss. Can you help?
You could do this . . .
call the function and pass the count for the number of consecutive profit trades you want, e.g. for 5 use this . . .
You could do this . . .
call the function and pass the count for the number of consecutive profit trades you want, e.g. for 5 use this . . .
Works a treat, thank you so much. I had been pulling my hair out over this!
Works a treat, thank you so much. I had been pulling my hair out over this!
You are welcome. It's not the definitive answer yet though . . . .
You may want to reset your starting point . . . imagine you have 5 consecutive profit trades . . . then you have a 6th and a 7th . . . this means you will have 3 sets of 5 consecutive trades, the first 5 in the series then 4 of the first series + the 6th, then 3 of the first series + 6th +7th . . . if this is OK for what you want then you are good to go. If you want unique series of 5 then there is a way to do it also . . .