This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let printStreamingWebReq (url : string, postContent : string) = | |
let req = WebRequest.Create url :?> HttpWebRequest | |
req.Method <- "POST" | |
req.Proxy <- null | |
let postDataEncoded = ASCIIEncoding.ASCII.GetBytes(postContent) | |
let len : int64 = int64 postDataEncoded.Length | |
req.ContentLength <- len | |
let reqStream = req.GetRequestStream() | |
reqStream.Write(postDataEncoded, 0, postDataEncoded.Length) | |
use response = req.GetResponse() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
type bar = | |
{ Symbol : string; Timestamp : DateTime; | |
Open : string; High : string; Low : string; Close : string; | |
Volume: int; | |
} | |
// F.US.DGH12 20111201 0107 110020 110020 110020 110020 1 | |
let parse_bar (line : string, delim : char) = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<T> DepthFirstSearch<T>(IEnumerable<T> start, Func<T, IEnumerable<T>> selector, Func<T, bool> predicate) | |
{ | |
var results = new List<T>(); | |
foreach (T item in start) | |
{ | |
if (predicate != null && predicate(item)) | |
results.Add(item); | |
else if (predicate == null) | |
results.Add(item); | |
var subItems = selector(item); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<T> FlattenTree<T>(IEnumerable<T> list, Func<T, IEnumerable<T>> subitems) | |
{ | |
foreach (T child in list) | |
{ | |
yield return child; | |
foreach (T other in FlattenTree(subitems(child), subitems)) | |
yield return other; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnBarUpdate() | |
{ | |
if (Historical) return;Enumerable.Range(0,14).ToList().ForEach(i =>DrawText((CurrentBar+i).ToString(),"\u0CA0_\u0CA0",0, i % 2 == 0 ? (Close[0]+TickSize) + (TickSize*i) : (Close[0]-TickSize)-(TickSize*i),i % 2 == 0 ? Color.FromArgb(255 - (i*15),0, 0,255):Color.FromArgb(255 - (i*15),255, 0,0))); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnBarUpdate() | |
{ | |
string indicator = "EMA"; | |
Type indicatorType = Type.GetType("NinjaTrader.Indicator." + indicator); | |
IndicatorBase indicatorBase = (IndicatorBase) Activator.CreateInstance(indicatorType); | |
Print(indicatorBase.GetHashCode() + ":" + indicatorBase.GetType().FullName); | |
indicatorBase.BarsRequired = BarsRequired; | |
indicatorBase.CalculateOnBarClose = CalculateOnBarClose; | |
indicatorBase.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; | |
indicatorBase.MaximumBarsLookBack = MaximumBarsLookBack; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.ComponentModel; | |
namespace NinjaTrader.Indicator | |
{ | |
[Description("f")] | |
public class derp : Indicator | |
{ | |
IndicatorBase myEMA; | |
protected override void Initialize() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.VisualStudio.QualityTools.CodedUITestFramework". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. | |
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.VisualStudio.TestTools.UITest.Common". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. | |
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.VisualStudio.TestTools.UITest.Extension". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. | |
c:\W |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add references WindowsBase, UIAutomationClient, UIAutomationTypes | |
// using System.Windows.Automation; | |
// using System.Windows; | |
[DllImport("user32.dll", CharSet = CharSet.Auto)] static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); | |
public void RightClick(AutomationElement element) | |
{ | |
const int WM_LBUTTONDOWN = 0x0201; | |
const int WM_LBUTTONUP = 0x0202; | |
Point point = element.GetClickablePoint(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class NativeMethods | |
{ | |
[DllImport("user32.dll")] | |
internal static extern void mouse_event([In]uint dwFlags, [In]int dx, [In]int dy, [In]uint dwData, [In]uint dwExtraInfo); | |
[Flags] | |
internal enum MOUSEEVENTF : uint | |
{ | |
MOVE = 0x00001, | |
LEFTDOWN = 0x00002, |
OlderNewer