Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace NinjaTrader.NinjaScript.Strategies
- {
- public class HighMinusOpen : Strategy
- {
- private PriorDayOHLC PriorDayOHLC1;
- private PriorDayOHLC PriorDayOHLC2;
- protected override void OnStateChange()
- {
- if (State == State.SetDefaults)
- {
- Description = @"Enter the description for your new custom Strategy here.";
- Name = "HighMinusOpen";
- Calculate = Calculate.OnBarClose;
- EntriesPerDirection = 1;
- EntryHandling = EntryHandling.AllEntries;
- IsExitOnSessionCloseStrategy = true;
- ExitOnSessionCloseSeconds = 30;
- IsFillLimitOnTouch = false;
- MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
- OrderFillResolution = OrderFillResolution.Standard;
- Slippage = 0;
- StartBehavior = StartBehavior.WaitUntilFlat;
- TimeInForce = TimeInForce.Gtc;
- TraceOrders = false;
- RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
- StopTargetHandling = StopTargetHandling.PerEntryExecution;
- BarsRequiredToTrade = 20;
- // Disable this property for performance gains in Strategy Analyzer optimizations
- // See the Help Guide for additional information
- IsInstantiatedOnEachOptimizationIteration = true;
- }
- else if (State == State.Configure)
- {
- }
- else if (State == State.DataLoaded)
- {
- PriorDayOHLC1 = PriorDayOHLC(High);
- PriorDayOHLC2 = PriorDayOHLC(Open);
- PriorDayOHLC1.Plots[0].Brush = Brushes.SteelBlue;
- PriorDayOHLC1.Plots[1].Brush = Brushes.DarkCyan;
- PriorDayOHLC1.Plots[2].Brush = Brushes.Crimson;
- PriorDayOHLC1.Plots[3].Brush = Brushes.SlateBlue;
- PriorDayOHLC2.Plots[0].Brush = Brushes.SteelBlue;
- PriorDayOHLC2.Plots[1].Brush = Brushes.DarkCyan;
- PriorDayOHLC2.Plots[2].Brush = Brushes.Crimson;
- PriorDayOHLC2.Plots[3].Brush = Brushes.SlateBlue;
- AddChartIndicator(PriorDayOHLC1);
- AddChartIndicator(PriorDayOHLC2);
- }
- }
- protected override void OnBarUpdate()
- {
- if (BarsInProgress != 0)
- return;
- if (CurrentBars[0] < 1)
- return;
- // Set 1
- if (PriorDayOHLC1.PriorOpen[1] < PriorDayOHLC2.PriorOpen[1])
- {
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement