Generic Return Value for Moving Averages? #1061
cperret977
started this conversation in
Help and support
Replies: 1 comment 3 replies
-
You can definitely do this. A while back, I’d done something like this for Rolling Moving Average, but it might benefit from a bit of refactoring to simplify. It might give you some inspiration. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First things first: I'm trying to cram learning C# programming and the use of this excellent library into the same project, so please... be gentle with me.
What I'm trying to do: I want to create a function that I can pass an integer value to that is used to select one of several moving averages, then return the results of the moving average to the calling function where those results will be used to determine trades. I'd like to make this function so that I can use the same selection parameters in multiple places and always get the same MA for the same input, without having to repeat a bunch of code.
Example:
So, I'm trying to figure out the proper type for MA in the System1 function and proper return type for the GetMovingAverage() function (and, by extension, the type for results in that function) - or find out that it's not possible to do what I'm trying to do and there's something else I should be doing instead. Is it just a matter of making all of these types an IResult or IReusableResult? Those seem to be what the separate MA result types are derived from, but I can't tell if that will get me what I need (date and MA value - same as one of the specific results).
Beta Was this translation helpful? Give feedback.
All reactions