I was hoping someone could take a look at this code and discover what I am doing wrong. The strat generates no trades in backtesting. The settings I'm using I used in another Strat that does pretty much the same thing, only it works there, but not on mine.
This is my first attempt at coding (used the wizard to generate), hoping to learn as much as anyone has the time to share.
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
///
/// A Test bot to see if EMA and RSI together can be profitable
///
[Description("A Test bot to see if EMA and RSI together can be profitable")]
public class TestEmaRsi : Strategy
{
#region Variables
// Wizard generated variables
private int eMAFast = 8; // Default setting for EMAFast
private int eMASlow = 14; // Default setting for EMASlow
private int rSIPeriod = 9; // Default setting for RSIPeriod
private int rSISmooth = 1; // Default setting for RSISmooth
private int rSITriggerHi = 51; // Default setting for RSITriggerHi
private int rSITriggerLo = 49; // Default setting for RSITriggerLo
private int sMAMedium = 50; // Default setting for SMAMedium
// User defined variables (add any user defined variables below)
#endregion
///
/// This method is used to configure the strategy and is called once before any strategy method is called.
///
protected override void Initialize()
{
SetStopLoss("", CalculationMode.Ticks, 9, false);
CalculateOnBarClose = true;
}
///
/// Called on each bar update event (incoming tick)
///
protected override void OnBarUpdate()
{
// Condition set 1
if (RSI(RSIPeriod, RSISmooth)[0] = SMA(SMAMedium)[0])
{
EnterLong(DefaultQuantity, "GoLong");
}
// Condition set 2
if (RSI(RSIPeriod, RSISmooth)[0] >= RSITriggerHi
&& CrossBelow(EMA(EMAFast), EMA(EMASlow), 1)
&& Close[0]