Skip to content

Instantly share code, notes, and snippets.

@bboyle1234
bboyle1234 / ShutdownEventCatcher.cs
Last active February 13, 2022 16:55
ShutdownEventCatcher provides all c# console application shutdown scenarios in a single handler
// Author: Benjamin Boyle
// Email: bboyle1234@gmail.com
using System;
using System.Runtime.InteropServices;
namespace Utils
{
///<summary>
/// Provides all c# console application shutdown scenarios in a single handler
@bboyle1234
bboyle1234 / TickDataContext
Created March 11, 2015 15:39
TickDataContext
using ApexSolid;
using ApexSolid.Data;
using ApexInvesting.Platform;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
@bboyle1234
bboyle1234 / TickDataContext.cs
Last active August 29, 2015 14:17
TickDataContext_02
#region class TickDataProvider
public static class TickDataProvider {
static readonly string default247 = "Default 24/7";
/// <summary>
/// Synchronization locks for accessing dataseries entries
/// </summary>
static readonly Dictionary<string, object> entryLocks = new Dictionary<string, object>();
@bboyle1234
bboyle1234 / Example Line Plotting
Last active August 29, 2015 14:17
Example line plotting
#region Plotting methods
#region PlotLine
protected void PlotLine(Graphics graphics, Rectangle bounds, double min, double max, Pen pen, Func<int, double?> GetLineValueAtIndex) {
var firstBarIndex = ChartControl.FirstBarPainted;
var lastBarIndex = Math.Min(BarsArray[0].Count - 1, ChartControl.LastBarPainted);
using (var path = new GraphicsPath()) {
for (var barIndex = firstBarIndex; barIndex < lastBarIndex; barIndex++) {
var value1 = GetLineValueAtIndex(barIndex);
var value2 = GetLineValueAtIndex(barIndex + 1);
if (value1.HasValue && value2.HasValue) {
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApplication1 {
class Program {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ApexTough.Data {
/// <summary>
/// Used to mark an object as having a series of timestamps in the local timezone accessible by index.
/// Each timestamp is assumed to be greater than or equal to the timestamp before.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ConsoleApplication1 {
@bboyle1234
bboyle1234 / BarStyleSettings.cs
Created June 8, 2015 13:30
BarStyleSettings
using NinjaTrader.Gui.Design;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Serialization;
@bboyle1234
bboyle1234 / DisposalTest.cs
Created June 19, 2015 18:16
DisposalTest
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
namespace ApexInvesting.Platform.Utilities.Drawing {
public enum HorizontalShiftPermissions {