2024-12-16 21:01:11 +00:00
|
|
|
#region Using declarations
|
|
|
|
using NinjaTrader.Cbi;
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace NinjaTrader.NinjaScript.Strategies
|
|
|
|
{
|
|
|
|
public class BearishEngulfingBot : Strategy
|
|
|
|
{
|
|
|
|
protected override void OnStateChange()
|
|
|
|
{
|
|
|
|
if (State == State.SetDefaults)
|
|
|
|
{
|
|
|
|
Name = "Bearish Engulfing Bot";
|
2024-12-16 21:02:53 +00:00
|
|
|
Description = @"Simple strategy based on the bearish engulfing candle pattern";
|
2024-12-16 21:01:11 +00:00
|
|
|
Calculate = Calculate.OnBarClose;
|
|
|
|
EntriesPerDirection = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnBarUpdate()
|
|
|
|
{
|
|
|
|
if (CurrentBar < BarsRequiredToTrade)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (Close[1] > Open[1] && Open[0] > Close[1] && Close[0] < Open[1])
|
|
|
|
EnterLong();
|
|
|
|
|
|
|
|
if (Position.MarketPosition == MarketPosition.Long && Close[0] > High[1])
|
|
|
|
ExitLong();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override string DisplayName
|
|
|
|
{
|
|
|
|
get { return Name; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|