Can someone please help me to get Longest losing streak in specific time frame? It should look at all of the trades in a daterange and find the longest loss streak. My code currently only gets the current streak, I can't figure out how to make it look at all executed trades and return the longest losing streak.
// Determine current losing streak length
streakLen = 0
streakLen := if (newLoss)
nz(streakLen[1]) + 1
else
if (strategy.wintrades > strategy.wintrades[1]) or
(strategy.eventrades > strategy.eventrades[1])
0
else
nz(streakLen[1])