-
Notifications
You must be signed in to change notification settings - Fork 0
/
DesignGraph.cs
80 lines (71 loc) · 2.42 KB
/
DesignGraph.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Takes Volume information in and prints it out in a graph.
/// </summary>
[Description("Takes Volume information in and prints it out in a graph.")]
public class DesignGraph : Strategy
{
#region Variables
// Wizard generated variables
private int periodWidth = 1; // Default setting for PeriodWidth
private int rangeInput = 1; // Default setting for RangeInput
private int volumeInput = 1; // Default setting for VolumeInput
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\Guilherme\Documents\writtenFiles\thetext.txt", true))
{
file.WriteLine(Time[1].Date.ToLongDateString()+","+Time[1].TimeOfDay.ToString()+","+High[1].ToString()+","+Low[1].ToString()+","+Volume[1].ToString());
}
}
#region Properties
[Description("")]
[GridCategory("Parameters")]
public int PeriodWidth
{
get { return periodWidth; }
set { periodWidth = Math.Max(1, value); }
}
[Description("")]
[GridCategory("Parameters")]
public int RangeInput
{
get { return rangeInput; }
set { rangeInput = Math.Max(1, value); }
}
[Description("")]
[GridCategory("Parameters")]
public int VolumeInput
{
get { return volumeInput; }
set { volumeInput = Math.Max(1, value); }
}
#endregion
}
}