Hi all, supposing I have 3 moving averages with 3 different lenghts. Which is the most efficient way to create a date series that is the lowest value of these moving averages. I use a loop with if else statements but i think it isn't the better way.
Thank you for your help
Size:
Color:
Hi,
Community.Indicators has two auxiliary DataSeries,
Highest2 and
Lowest2, which return the highest (lowest) of two series (respectively). Using them you can practically get a one-liner solution:
CODE:
Please log in to see this code.
Warning: these helpers are rudimentary as they don't expect in principle that the DataSeries you pass to it may have different bar counts. As they're not universal, no synchronization or bound checking is going on under the hood at all. Make sure you pass two DataSeries of equal length i.e. not based on several Bars objects with a different bar count.
Size:
Color:
Thank you very much Eugene
Size:
Color:
May I use more then 3 moving averages?
I tried to code this without success...
Size:
Color:
Sure:
CODE:
Please log in to see this code.
Ideally you'd need a new universal procedure (independent of the
Lowest2). It would accept a List of
DataSeries and loop by their values at a given bar.
Size:
Color:
Or give this a try:
CODE:
Please log in to see this code.
Not universal yet but much easier for you to extend:
CODE:
Please log in to see this code.
Size:
Color:
Thank you very much, I try this
Size:
Color: