diff --git a/Financial_Candlestick_Patterns.sln b/Financial_Candlestick_Patterns.sln
index 7b41250..a2ae507 100644
--- a/Financial_Candlestick_Patterns.sln
+++ b/Financial_Candlestick_Patterns.sln
@@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Examples_Formations", "Exam
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Examples_Patterns", "Examples_Patterns\Examples_Patterns.csproj", "{23135CD8-163D-4C86-8017-1036D76F5C0D}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphCreator", "GraphCreator\GraphCreator.csproj", "{D100D9CC-005D-4220-AEA2-63D008FA8A28}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -39,6 +41,10 @@ Global
{23135CD8-163D-4C86-8017-1036D76F5C0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23135CD8-163D-4C86-8017-1036D76F5C0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23135CD8-163D-4C86-8017-1036D76F5C0D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D100D9CC-005D-4220-AEA2-63D008FA8A28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D100D9CC-005D-4220-AEA2-63D008FA8A28}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D100D9CC-005D-4220-AEA2-63D008FA8A28}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D100D9CC-005D-4220-AEA2-63D008FA8A28}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/GraphCreator/Form1.Designer.cs b/GraphCreator/Form1.Designer.cs
new file mode 100644
index 0000000..754305b
--- /dev/null
+++ b/GraphCreator/Form1.Designer.cs
@@ -0,0 +1,39 @@
+namespace GraphCreator
+{
+ partial class Form1
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Text = "Form1";
+ }
+
+ #endregion
+ }
+}
diff --git a/GraphCreator/Form1.cs b/GraphCreator/Form1.cs
new file mode 100644
index 0000000..c02730b
--- /dev/null
+++ b/GraphCreator/Form1.cs
@@ -0,0 +1,10 @@
+namespace GraphCreator
+{
+ public partial class Form1 : Form
+ {
+ public Form1()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/GraphCreator/Form1.resx b/GraphCreator/Form1.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/GraphCreator/Form1.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/GraphCreator/GraphCreator.csproj b/GraphCreator/GraphCreator.csproj
new file mode 100644
index 0000000..abe5ceb
--- /dev/null
+++ b/GraphCreator/GraphCreator.csproj
@@ -0,0 +1,20 @@
+
+
+
+ WinExe
+ net8.0-windows
+ enable
+ true
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GraphCreator/Program.cs b/GraphCreator/Program.cs
new file mode 100644
index 0000000..dfd9d3b
--- /dev/null
+++ b/GraphCreator/Program.cs
@@ -0,0 +1,121 @@
+using Candlestick_Patterns;
+using System.Windows.Forms.DataVisualization.Charting;
+using GraphMaker;
+
+namespace Dino.Tools.WebMonitor
+{
+ public class Graph : Form
+ {
+ private System.ComponentModel.IContainer components = null;
+ System.Windows.Forms.DataVisualization.Charting.Chart chart1;
+
+ IFiboTester _fiboTester = new FiboTester();
+
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new Graph());
+ }
+ public Graph()
+ {
+ InitializeComponent();
+ }
+
+ private void Form1_Load(object sender, EventArgs e)
+ {
+ chart1.Series.Clear();
+ var series1 = new System.Windows.Forms.DataVisualization.Charting.Series
+ {
+ Name = "graph",
+ Color = System.Drawing.Color.Green,
+ IsVisibleInLegend = false,
+ IsXValueIndexed = true,
+ ChartType = SeriesChartType.Line
+ };
+
+ this.chart1.Series.Add(series1);
+
+ var patternName = "BullishButterfly";
+ //var points = GetGraphData(patternName);
+ var points = new List()
+ {
+ new ZigZagObject() {Close = 2.5M, Signal = false},
+ new ZigZagObject() {Close = 3.5M, Signal = true},
+ new ZigZagObject() {Close = 4.5M, Signal = true},
+ new ZigZagObject() {Close = 4.5M, Signal = false} ,
+ };
+
+ for (int i = 0; i < points.Count; i++)
+ {
+ var item = points[i];
+ series1.Points.AddXY(i, item.Close);
+ if (item.Signal == true)
+ {
+ series1.Points[i].MarkerStyle = MarkerStyle.Triangle;
+ series1.Points[i].MarkerSize = 5;
+ series1.Points[i].MarkerColor = Color.Red;
+ }
+ }
+
+ chart1.Invalidate();
+ }
+
+ private List GetGraphData(string patternName)
+ {
+ return _fiboTester.GetGraphData(patternName);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ private void InitializeComponent()
+ {
+ ChartArea chartArea1 = new ChartArea();
+ Legend legend1 = new Legend();
+ chart1 = new Chart();
+ ((System.ComponentModel.ISupportInitialize)chart1).BeginInit();
+ SuspendLayout();
+ //
+ // chart1
+ //
+ chartArea1.Name = "ChartArea1";
+ chart1.ChartAreas.Add(chartArea1);
+ chart1.Dock = DockStyle.Fill;
+ legend1.Name = "Legend1";
+ chart1.Legends.Add(legend1);
+ chart1.Location = new Point(0, 0);
+ chart1.Margin = new Padding(4, 5, 4, 5);
+ chart1.Name = "chart1";
+ chart1.Size = new Size(379, 403);
+ chart1.TabIndex = 0;
+ chart1.Text = "chart1";
+ chart1.Click += chart1_Click;
+ //
+ // Graph
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(379, 403);
+ Controls.Add(chart1);
+ Margin = new Padding(4, 5, 4, 5);
+ Name = "Graph";
+ Text = "Graph";
+ Load += Form1_Load;
+ ((System.ComponentModel.ISupportInitialize)chart1).EndInit();
+ ResumeLayout(false);
+ }
+
+ private void chart1_Click(object sender, EventArgs e)
+ {
+
+ }
+ }
+}
diff --git a/GraphCreator/Program.resx b/GraphCreator/Program.resx
new file mode 100644
index 0000000..8b2ff64
--- /dev/null
+++ b/GraphCreator/Program.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/GraphMaker/FiboTester.cs b/GraphMaker/FiboTester.cs
index 251e178..46d3072 100644
--- a/GraphMaker/FiboTester.cs
+++ b/GraphMaker/FiboTester.cs
@@ -1,32 +1,60 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Candlestick_Patterns;
-using OHLC_Candlestick_Patterns;
+using Candlestick_Patterns;
+using Newtonsoft.Json;
using ScottPlot;
namespace GraphMaker
{
- internal interface IFiboTester
+ public interface IFiboTester
{
void ShowOnGraph(List dataOhlcv, string patternName);
+ List GetGraphData(string patternName);
+ Task> GetPoints(string patternName);
}
-
- internal class FiboTester : IFiboTester
+
+ public class FiboTester : IFiboTester
{
IFibonacci _fibonacci;
+ public async Task> GetPoints(string patternName)
+ {
+ string json = string.Empty;
+ ISignals _signals = new Signals();
+ IFiboTester _fiboTester = new FiboTester();
+ IFibonacci _fibonacci;
+
+ var client = new HttpClient();
+ var url = "https://gist.githubusercontent.com/przemyslawbak/c90528453d512a8d85ad2deea5cf6ad2/raw/aapl_us_d.csv";
+
+ using (HttpResponseMessage response = await client.GetAsync(url))
+ {
+ using (HttpContent content = response.Content)
+ {
+ json = content.ReadAsStringAsync().Result;
+ }
+ }
+
+ var dataOhlcv = JsonConvert.DeserializeObject>(json).Select(x => new OhlcvObject()
+ {
+ Open = x.Open,
+ High = x.High,
+ Low = x.Low,
+ Close = x.Close,
+ Volume = x.Volume,
+ }).Reverse().ToList();
+
+
+ _fibonacci = new Fibonacci(dataOhlcv);
+ var signalList = _fibonacci.GetFibonacciSignalsList(patternName);
+ return signalList;
+ }
void IFiboTester.ShowOnGraph(List dataOhlcv, string patternName)
{
_fibonacci = new Fibonacci(dataOhlcv);
var signalList = _fibonacci.GetFibonacciSignalsList(patternName);
- GetGraph(signalList);
+ GetGraph(signalList, patternName);
}
- static void GetGraph(List points)
+ static void GetGraph(List points, string patternName)
{
var plt = new Plot();
var numbers = new List();
@@ -47,6 +75,7 @@ static void GetGraph(List points)
var numbersArray = numbers.ToArray();
var myScatter = plt.Add.Scatter(numbersArray, pointsPlot);
+
ScottPlot.Palettes.Category20 palette = new();
for (int i = 0; i < points.Count; i++)
{
@@ -59,8 +88,8 @@ static void GetGraph(List points)
mp.MarkerStyle.FillColor = palette.GetColor(8);
mp.MarkerStyle.Size = 1.5F;
mp.MarkerStyle.OutlineColor = palette.GetColor(8);
- //mp.MarkerStyle.OutlineWidth = 2;
- //mp.MarkerStyle.LineWidth = 2f;
+ mp.MarkerStyle.OutlineWidth = 2;
+ mp.MarkerStyle.LineWidth = 2f;
mp.MarkerStyle.LineColor = palette.GetColor(10);
}
}
@@ -76,12 +105,17 @@ static void GetGraph(List points)
//myScatter.MaxRenderIndex = points.Count;
// save
- var fn = $"Plot_points.png";
- // plt.SavePng(fn, 10000, 1000);
- fn = $"Plot_points.svg";
+ var fn = $"Data\\graph_{patternName}.svg";
plt.SaveSvg(fn, 50000, 2000);
}
+
+ public List GetGraphData(string patternName)
+ {
+ var signalList = GetPoints(patternName);
+ List points = signalList.Result;
+ return points;
+ }
}
}
diff --git a/GraphMaker/Program.cs b/GraphMaker/Program.cs
index 8e42ec8..8e2d3cc 100644
--- a/GraphMaker/Program.cs
+++ b/GraphMaker/Program.cs
@@ -3,8 +3,8 @@
using Newtonsoft.Json;
string json = string.Empty;
-ISignals _signals = new Signals();
IFiboTester _fiboTester = new FiboTester();
+
var client = new HttpClient();
var url = "https://gist.githubusercontent.com/przemyslawbak/c90528453d512a8d85ad2deea5cf6ad2/raw/aapl_us_d.csv";
@@ -26,3 +26,5 @@
}).Reverse().ToList();
_fiboTester.ShowOnGraph(dataOhlcv, "BullishButterfly");
+
+
diff --git a/GraphMaker/graph_BullishButterfly.svg b/GraphMaker/graph_BullishButterfly.svg
new file mode 100644
index 0000000..10fce40
--- /dev/null
+++ b/GraphMaker/graph_BullishButterfly.svg
@@ -0,0 +1,13092 @@
+
+