refactor structs to records, add new classes for financial calculations, implement EMA and SMA with circular buffer. Generate random financial data using GBM model. Also, test the SMA calculation with sample data.

This commit is contained in:
Miha Kralj
2024-07-28 21:26:44 -07:00
parent ef534393db
commit 3455baaf6c
95 changed files with 8661 additions and 7012 deletions
+20 -3
View File
@@ -4,17 +4,34 @@
#!csharp
#load "./base.cs"
#r "..\v2\bin\Debug\calculations.dll"
using QuanTAlib;
#!csharp
TValue vv = new(10);
display(vv.ToString());
display(vv.IsHot);
TBar bb = new(1,1,1,1,10);
display(bb.ToString());
display(bb.IsNew);
#!csharp
TBar bb = new();
display(bb.ToString());
int i=10;
SMA sma = new(i);
Console.WriteLine($"{"Close",10} {"SMA(" + i + ")",10}");
for (int i = 0; i < 20; i++)
{
TValue c =(double)i+1;
sma.Update(10000,true);
sma.Update(1,false);
sma.Update(-1000,false);
sma.Update(c,false);
Console.WriteLine($"{i+1} {(double)c,10:F2} {(double)sma.Value,10:F2} {sma.Value.IsHot}");
}
#!csharp