Created
September 14, 2023 20:42
-
-
Save iamjaime/5f12e46bca11e0360b6cbc687e36c470 to your computer and use it in GitHub Desktop.
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
#region Using declarations | |
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.ComponentModel.DataAnnotations; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows; | |
using System.Windows.Input; | |
using System.Windows.Media; | |
using System.Xml.Serialization; | |
using NinjaTrader.Cbi; | |
using NinjaTrader.Gui; | |
using NinjaTrader.Gui.Chart; | |
using NinjaTrader.Gui.SuperDom; | |
using NinjaTrader.Gui.Tools; | |
using NinjaTrader.Data; | |
using NinjaTrader.NinjaScript; | |
using NinjaTrader.Core.FloatingPoint; | |
using NinjaTrader.NinjaScript.Indicators; | |
using NinjaTrader.NinjaScript.DrawingTools; | |
using NinjaTrader.NinjaScript.Indicators.TDU; | |
#endregion | |
//This namespace holds Strategies in this folder and is required. Do not change it. | |
namespace NinjaTrader.NinjaScript.Strategies | |
{ | |
public class Zone : Strategy | |
{ | |
TDUFootPrint footPrint; | |
protected override void OnStateChange() | |
{ | |
if (State == State.SetDefaults) | |
{ | |
Description = @"uses orderflow"; | |
Name = "Zone"; | |
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) | |
{ | |
AddDataSeries(BarsPeriodType.Tick, 1); // Load up the 1 Tick Chart | |
} | |
else if (State == State.DataLoaded) | |
{ | |
// Create Instance | |
footPrint = TDUFootPrint(); | |
footPrint.ShowOversizedImbalances = true; | |
footPrint.ShowStackedImbalance = true; | |
footPrint.ShowSummary = true; | |
footPrint.ShowVolumeSequencing = true; | |
footPrint.ShowDeltaRiseStripe = true; | |
footPrint.ShowDeltaDropStripe = true; | |
footPrint.ShowDeltaFlipStripe = true; | |
footPrint.ShowImbalance = true; | |
footPrint.ExtendVALHPOC = true; | |
AddChartIndicator(footPrint); | |
} | |
} | |
protected override void OnBarUpdate() | |
{ | |
//Add your custom strategy logic here. | |
if (CurrentBar < BarsRequiredToTrade || CurrentBars[0] < BarsRequiredToTrade || CurrentBars[1] < BarsRequiredToTrade) | |
return; | |
if (State == State.Historical) | |
return; | |
if (BarsInProgress == 0) { | |
if ( Position.MarketPosition == MarketPosition.Flat ) { | |
isLongCriteriaMet(); | |
isShortCriteriaMet(); | |
} | |
} | |
} | |
protected bool isLongCriteriaMet() | |
{ | |
return false; | |
} | |
protected bool isShortCriteriaMet() | |
{ | |
return false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment