Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MovingAverageConvergenceDivergence and .Macd both unusable #32

Closed
michael-cohen-io opened this issue Jan 24, 2018 · 4 comments
Closed

Comments

@michael-cohen-io
Copy link

I am attempting to utilize the MACD indicators in this library and keep having exceptions thrown whenever the indicator is instantiated or computed. I tried debugging in several different manners to no avail. If necesarry I can post the larger code context but I don't believe that it is the issue since I can create and execute RSI, EMA, and MA indicators with no issue using the same parameters

  • When utilizing Trady in the traditional manner, the following occurs:
    var tCandles = ToTradyCandles(allCandlesForCoin); var macd = new MovingAverageConvergenceDivergence(tCandles, MA_period_fast, MA_period_slow, signal_period).Compute();

Throws the exception:

Managed Debugging Assistant 'FatalExecutionEngineError'
The runtime has encountered a fatal error. The address of the error was at 0x74841f8d, on thread 0x4338. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

  • When utilizing Trady in the extension manner, the following occurs:
    var currentValues = tCandles.Macd(MA_period_fast, MA_period_slow, signal_period)[tCandles.Count - 1].Tick;

Throws the exception:

Exception thrown: 'System.MissingMethodException' in Tex.exe
Exception thrown: 'System.AggregateException' in mscorlib.dll
Exception thrown: 'System.AggregateException' in mscorlib.dll
System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>Tex.exe</AppDomain><Exception><ExceptionType>System.AggregateException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>One or more errors occurred.</Message><StackTrace>   at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout)
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks)
   at Tex.Driver.StartDriver() in C:\Users\Administrator\source\repos\Tex\Tex\Driver.cs:line 187
   at Tex.Program.Main(String[] args) in C:\Users\Administrator\source\repos\Tex\Tex\Program.cs:line 16</StackTrace><ExceptionString>System.AggregateException: One or more errors occurred. ---&amp;gt; System.AggregateException: One or more errors occurred. ---&amp;gt; System.MissingMethodException: Method not found: 'System.Collections.Generic.IReadOnlyList`1&amp;lt;Trady.Analysis.AnalyzableTick`1&amp;lt;System.ValueTuple`3&amp;lt;System.Nullable`1&amp;lt;System.Decimal&amp;gt;,System.Nullable`1&amp;lt;System.Decimal&amp;gt;,System.Nullable`1&amp;lt;System.Decimal&amp;gt;&amp;gt;&amp;gt;&amp;gt; Trady.Analysis.CandlesExtension.Macd(System.Collections.Generic.IEnumerable`1&amp;lt;Trady.Core.Candle&amp;gt;, Int32, Int32, Int32, System.Nullable`1&amp;lt;Int32&amp;gt;, System.Nullable`1&amp;lt;Int32&amp;gt;)'.
   at Tex.Commands.MACDCommand.Execute(List`1 allCandlesForCoin)
   at Tex.Driver.&amp;lt;&amp;gt;c__DisplayClass2_1.&amp;lt;Execute&amp;gt;b__2() in C:\Users\Administrator\source\repos\Tex\Tex\Driver.cs:line 245
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout)
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks)
   at Tex.Driver.Execute(List`1 allCandles, Int64 newestTimestamp) in C:\Users\Administrator\source\repos\Tex\Tex\Driver.cs:line 254
   at Tex.Driver.&amp;lt;&amp;gt;c__DisplayClass1_2.&amp;lt;StartDriver&amp;gt;b__1() in C:\Users\Administrator\source\repos\Tex\Tex\Driver.cs:line 180
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout)
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks)
   at Tex.Driver.StartDriver() in C:\Users\Administrator\source\repos\Tex\Tex\Driver.cs:line 187
   at Tex.Program.Main(String[] args) in C:\Users\Administrator\source\repos\Tex\Tex\Program.cs:line 16
---&amp;gt; (Inner Exception #0) System.AggregateException: One or more errors occurred. ---&amp;gt; System.MissingMethodException: Method not found: 'System.Collections.Generic.IReadOnlyList`1&amp;lt;Trady.Analysis.AnalyzableTick`1&amp;lt;System.ValueTuple`3&amp;lt;System.Nullable`1&amp;lt;System.Decimal&amp;gt;,System.Nullable`1&amp;lt;System.Decimal&amp;gt;,System.Nullable`1&amp;lt;System.Decimal&amp;gt;&amp;gt;&amp;gt;&amp;gt; Trady.Analysis.CandlesExtension.Macd(System.Collections.Generic.IEnumerable`1&amp;lt;Trady.Core.Candle&amp;gt;, Int32, Int32, Int32, System.Nullable`1&amp;lt;Int32&amp;gt;, System.Nullable`1&amp;lt;Int32&amp;gt;)'.
   at Tex.Commands.MACDCommand.Execute(List`1 allCandlesForCoin)
   at Tex.Driver.&amp;lt;&amp;gt;c__DisplayClass2_1.&amp;lt;Execute&amp;gt;b__2() in C:\Users\Administrator\source\repos\Tex\Tex\Driver.cs:line 245
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout)
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks)
   at Tex.Driver.Execute(List`1 allCandles, Int64 newestTimestamp) in C:\Users\Administrator\source\repos\Tex\Tex\Driver.cs:line 254
   at Tex.Driver.&amp;lt;&amp;gt;c__DisplayClass1_2.&amp;lt;StartDriver&amp;gt;b__1() in C:\Users\Administrator\source\repos\Tex\Tex\Driver.cs:line 180
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
---&amp;gt; (Inner Exception #0) System.MissingMethodException: Method not found: 'System.Collections.Generic.IReadOnlyList`1&amp;lt;Trady.Analysis.AnalyzableTick`1&amp;lt;System.ValueTuple`3&amp;lt;System.Nullable`1&amp;lt;System.Decimal&amp;gt;,System.Nullable`1&amp;lt;System.Decimal&amp;gt;,System.Nullable`1&amp;lt;System.Decimal&amp;gt;&amp;gt;&amp;gt;&amp;gt; Trady.Analysis.CandlesExtension.Macd(System.Collections.Generic.IEnumerable`1&amp;lt;Trady.Core.Candle&amp;gt;, Int32, Int32, Int32, System.Nullable`1&amp;lt;Int32&amp;gt;, System.Nullable`1&amp;lt;Int32&amp;gt;)'.
   at Tex.Commands.MACDCommand.Execute(List`1 allCandlesForCoin)
   at Tex.Driver.&amp;lt;&amp;gt;c__DisplayClass2_1.&amp;lt;Execute&amp;gt;b__2() in C:\Users\Administrator\source\repos\Tex\Tex\Driver.cs:line 245
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()&amp;lt;---
&amp;lt;---
</ExceptionString><InnerException><ExceptionType>System.AggregateException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>One or more errors occurred.</Message><StackTrace>   at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout)
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks)
   at Tex.Driver.Execute(List`1 allCandles, Int64 newestTimestamp) in C:\Users\Administrator\source\repos\Tex\Tex\Driver.cs:line 254
   at Tex.Driver.&amp;lt;&amp;gt;c__DisplayClass1_2.&amp;lt;StartDriver&amp;gt;b__1() in C:\Users\Administrator\source\repos\Tex\Tex\Driver.cs:line 180
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()</StackTrace><ExceptionString>System.AggregateException: One or more errors occurred. ---&amp;gt; System.MissingMethodException: Method not found: 'System.Collections.Generic.IReadOnlyList`1&amp;lt;Trady.Analysis.AnalyzableTick`1&amp;lt;System.ValueTuple`3&amp;lt;System.Nullable`1&amp;lt;System.Decimal&amp;gt;,System.Nullable`1&amp;lt;System.Decimal&amp;gt;,System.Nullable`1&amp;lt;System.Decimal&amp;gt;&amp;gt;&amp;gt;&amp;gt; Trady.Analysis.CandlesExtension.Macd(System.Collections.Generic.IEnumerable`1&amp;lt;Trady.Core.Candle&amp;gt;, Int32, Int32, Int32, System.Nullable`1&amp;lt;Int32&amp;gt;, System.Nullable`1&amp;lt;Int32&amp;gt;)'.
   at Tex.Commands.MACDCommand.Execute(List`1 allCandlesForCoin)
   at Tex.Driver.&amp;lt;&amp;gt;c__DisplayClass2_1.&amp;lt;Execute&amp;gt;b__2() in C:\Users\Administrator\source\repos\Tex\Tex\Driver.cs:line 245
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout)
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks)
   at Tex.Driver.Execute(List`1 allCandles, Int64 newestTimestamp) in C:\Users\Administrator\source\repos\Tex\Tex\Driver.cs:line 254
   at Tex.Driver.&amp;lt;&amp;gt;c__DisplayClass1_2.&amp;lt;StartDriver&amp;gt;b__1() in C:\Users\Administrator\source\repos\Tex\Tex\Driver.cs:line 180
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
---&amp;gt; (Inner Exception #0) System.MissingMethodException: Method not found: 'System.Collections.Generic.IReadOnlyList`1&amp;lt;Trady.Analysis.AnalyzableTick`1&amp;lt;System.ValueTuple`3&amp;lt;System.Nullable`1&amp;lt;System.Decimal&amp;gt;,System.Nullable`1&amp;lt;System.Decimal&amp;gt;,System.Nullable`1&amp;lt;System.Decimal&amp;gt;&amp;gt;&amp;gt;&amp;gt; Trady.Analysis.CandlesExtension.Macd(System.Collections.Generic.IEnumerable`1&amp;lt;Trady.Core.Candle&amp;gt;, Int32, Int32, Int32, System.Nullable`1&amp;lt;Int32&amp;gt;, System.Nullable`1&amp;lt;Int32&amp;gt;)'.
   at Tex.Commands.MACDCommand.Execute(List`1 allCandlesForCoin)
   at Tex.Driver.&amp;lt;&amp;gt;c__DisplayClass2_1.&amp;lt;Execute&amp;gt;b__2() in C:\Users\Administrator\source\repos\Tex\Tex\Driver.cs:line 245
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()&amp;lt;---
</ExceptionString><InnerException><ExceptionType>System.MissingMethodException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Method not found: 'System.Collections.Generic.IReadOnlyList`1&amp;lt;Trady.Analysis.AnalyzableTick`1&amp;lt;System.ValueTuple`3&amp;lt;System.Nullable`1&amp;lt;System.Decimal&amp;gt;,System.Nullable`1&amp;lt;System.Decimal&amp;gt;,System.Nullable`1&amp;lt;System.Decimal&amp;gt;&amp;gt;&amp;gt;&amp;gt; Trady.Analysis.CandlesExtension.Macd(System.Collections.Generic.IEnumerable`1&amp;lt;Trady.Core.Candle&amp;gt;, Int32, Int32, Int32, System.Nullable`1&amp;lt;Int32&amp;gt;, System.Nullable`1&amp;lt;Int32&amp;gt;)'.</Message><StackTrace>   at Tex.Commands.MACDCommand.Execute(List`1 allCandlesForCoin)
   at Tex.Driver.&amp;lt;&amp;gt;c__DisplayClass2_1.&amp;lt;Execute&amp;gt;b__2() in C:\Users\Administrator\source\repos\Tex\Tex\Driver.cs:line 245
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()</StackTrace><ExceptionString>System.MissingMethodException: Method not found: 'System.Collections.Generic.IReadOnlyList`1&amp;lt;Trady.Analysis.AnalyzableTick`1&amp;lt;System.ValueTuple`3&amp;lt;System.Nullable`1&amp;lt;System.Decimal&amp;gt;,System.Nullable`1&amp;lt;System.Decimal&amp;gt;,System.Nullable`1&amp;lt;System.Decimal&amp;gt;&amp;gt;&amp;gt;&amp;gt; Trady.Analysis.CandlesExtension.Macd(System.Collections.Generic.IEnumerable`1&amp;lt;Trady.Core.Candle&amp;gt;, Int32, Int32, Int32, System.Nullable`1&amp;lt;Int32&amp;gt;, System.Nullable`1&amp;lt;Int32&amp;gt;)'.
   at Tex.Commands.MACDCommand.Execute(List`1 allCandlesForCoin)
   at Tex.Driver.&amp;lt;&amp;gt;c__DisplayClass2_1.&amp;lt;Execute&amp;gt;b__2() in C:\Users\Administrator\source\repos\Tex\Tex\Driver.cs:line 245
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()</ExceptionString></InnerException></InnerException></Exception></TraceRecord>
An unhandled exception of type 'System.AggregateException' occurred in mscorlib.dll
One or more errors occurred.
@karlwancl
Copy link
Owner

Probably the same issue as #27. It seems the error is caused because the return type is a valuetuple, it's probably a bug of clr as i do not use any unsafe code or external call to com component. I am quite busy now & may not have time to dig deep to the problem but i will try.

@michael-cohen-io
Copy link
Author

I notice that the longer error in my second example has mention of a MissingMethodException. Maybe it might have to do with the way you set up the return types as you mentioned. Anyway please let me know once you have time to work on this bug and if you need help reproducing it. I tested the MACD method calls (both traditional and extension types) in a sandboxed environment and still got the same errors while other indicator calls such as EMA, RSI, and MA all work fine.

@irperez
Copy link
Collaborator

irperez commented Feb 19, 2018

@mickeyjk could you provide a sample unit test with test data (csv format) to replicate the issue? The smaller the data set, the better and easier to diagnose.

@karlwancl
Copy link
Owner

The issue is no longer active, closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants