I am including the relevant bits of my code. I am experiencing no issues in the debugger. Strategy runs. And behaves. Just not as expected.
I set profit target at 500, stop loss at 2000.
Given the following code, I am seeing results like profit not being taken at 500. I saw profit go today to 700, then back down to 300 before it became realized.
I see stop losses exiting in the hundreds, so it exits too early if I am telling it to wait until 2000.
No sound is played, ever.
The positions are not closed at the end of the day, but the end of the day alerts work and no more orders are placed.
What am I doing wrong?
I see no errors in my Log. But I do wish the log was easier to read. I also wish the executions tab showed profit/loss for each row. That seems like a HUGE glaring omission, like forgetting to include a "Send" button in an email app huge.
Thanks for any and all advice.
This is where I am assigning my profit target and stop loss for each entry label, using user inputs (defaults are 500 target and 2000 loss)
SetProfitTarget(@"Buy Long", CalculationMode.Currency, ProfitTarget); SetStopLoss(@"Buy Long", CalculationMode.Currency, StopLoss, false); SetProfitTarget(@"Buy Short", CalculationMode.Currency, ProfitTargetShort); SetStopLoss(@"Buy Short", CalculationMode.Currency, StopLossShort, false);
EnterLong(Convert.ToInt32(DefaultQuantity), @"Buy Long"); Alert(@"SmokySignals_1", Priority.High, @"Buy Long" + Convert.ToString(Close[0]) + " " + Convert.ToString(High[0]) + " " + Convert.ToString(Low[0]), @"", 30, Brushes.Chartreuse, Brushes.Black); if (Instrument.MasterInstrument.Name == "TSLA"){ PlaySound(@"C:\Program Files (x86)\NinjaTrader 8\sounds\Buy-TSLA-Long.wav"); } else if(Instrument.MasterInstrument.Name == "AAPL"){ PlaySound(@"C:\Program Files (x86)\NinjaTrader 8\sounds\Buy-AAPL-Long.wav"); } else if(Instrument.MasterInstrument.Name == "FB"){ PlaySound(@"C:\Program Files (x86)\NinjaTrader 8\sounds\Buy-FB-Long.wav"); } else if(Instrument.MasterInstrument.Name == "QS"){ PlaySound(@"C:\Program Files (x86)\NinjaTrader 8\sounds\Buy-QS-Long.wav"); }
EnterShort(Convert.ToInt32(DefaultQuantity), @"Buy Short"); Alert(@"SmokySignals_1", Priority.High, @"Buy Short" + Convert.ToString(Close[0]) + " " + Convert.ToString(High[0]) + " " + Convert.ToString(Low[0]), @"", 30, Brushes.DodgerBlue, Brushes.Black); if (Instrument.MasterInstrument.Name == "TSLA"){ PlaySound(@"C:\Program Files (x86)\NinjaTrader 8\sounds\Buy-TSLA-Short.wav"); } else if(Instrument.MasterInstrument.Name == "AAPL"){ PlaySound(@"C:\Program Files (x86)\NinjaTrader 8\sounds\Buy-AAPL-Short.wav"); } else if(Instrument.MasterInstrument.Name == "FB"){ PlaySound(@"C:\Program Files (x86)\NinjaTrader 8\sounds\Buy-FB-Short.wav"); } else if(Instrument.MasterInstrument.Name == "QS"){ PlaySound(@"C:\Program Files (x86)\NinjaTrader 8\sounds\Buy-QS-Short.wav"); }
if (DateTime.Now > EndTime){ ExitLong(@"Buy Long"); ExitShort(@"Buy Short"); Alert(@"SmokySignals_1", Priority.High, @"Closing - End of Day " + Convert.ToString(Close[0]) + " " + Convert.ToString(High[0]) + " " + Convert.ToString(Low[0]), @"", 30, Brushes.Pink, Brushes.Black); }
Comment