2024-11-14 13:53:22 +00:00
|
|
|
#region Using declarations
|
|
|
|
using NinjaTrader.Cbi;
|
|
|
|
using System;
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace NinjaTrader.NinjaScript.Strategies
|
|
|
|
{
|
|
|
|
public class TurnaroundBot : Strategy
|
|
|
|
{
|
|
|
|
protected override void OnStateChange()
|
|
|
|
{
|
|
|
|
if (State == State.SetDefaults)
|
|
|
|
{
|
|
|
|
Name = "Turnaround Bot";
|
2024-11-14 13:54:58 +00:00
|
|
|
Description = @"Turnaround Tuesday / Wednesday";
|
2024-11-14 13:53:22 +00:00
|
|
|
Calculate = Calculate.OnBarClose;
|
|
|
|
EntriesPerDirection = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnBarUpdate()
|
|
|
|
{
|
|
|
|
if (CurrentBar < BarsRequiredToTrade) return;
|
|
|
|
|
|
|
|
if ((Time[0].DayOfWeek == DayOfWeek.Monday || Time[0].DayOfWeek == DayOfWeek.Tuesday) &&
|
|
|
|
Close[0] < Close[1] && Close[1] < Close[2])
|
|
|
|
EnterLong();
|
|
|
|
|
|
|
|
if (Position.MarketPosition == MarketPosition.Long && Close[0] > High[1])
|
|
|
|
ExitLong();
|
|
|
|
}
|
2024-11-14 13:56:44 +00:00
|
|
|
|
|
|
|
public override string DisplayName
|
|
|
|
{
|
|
|
|
get { return Name; }
|
|
|
|
}
|
2024-11-14 13:53:22 +00:00
|
|
|
}
|
|
|
|
}
|