Return indicator as async Task #1113
urbanchaman
started this conversation in
Help and support
Replies: 1 comment
-
It looks like you're trying to setup an asynchronous threading pattern. The basic use of this ADX indicator is a static synchronous pattern that looks like this: // get results synchronously (normal way)
IEnumerable<AdxResult> results = quotes.GetAdx(lookbackPeriods); Generally speaking, since there are no awaited aspects in this library, you wouldn't need to use an asynchronous pattern for indicators. In fact, it can be slower performance in most use cases. However, if you do have a good use case for asynchronous Option 1: Use
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! I'm pretty new to C#. I want to make a method to get the result history of any indicator. Something like this:
async Task<List> GetIndicator(Task<List> priceData, string name, int lookback)
{
var data = await priceData;
switch (name)
{
case "Adx":
return data.GetAdx(lookback);
break;
case "AtrStop":
return data.GetAtrStop(lookback);
break;
etc..
}
}
I just can't figure out what to use as return type. I'm sure this is because I don't know some basic C# stuff, but I would be more than greatful for a hint. Thank you very much!
Beta Was this translation helpful? Give feedback.
All reactions