Upon adding a strategy and STARTING it with the following initialize portion, the following profittarget limit order and stoploss order get sent to my broker. But there is no trigger and the actual buy doesn't occur. The scripts backtest properly. They just do this strange behavior -sometimes- upon starting the script. Anyway to make sure the contigent orders only enter when the conditions are met for my long order?
Whats fascinating is that in the control center, upon starting the strategy, it says it establishes a long position for X contracts, but does it without sending the actual order and without the actual trigger being met. I know this because i have some debug print statements to an output window that go with my long order section.
Any ideas?
protectedoverridevoid Initialize()
{
SetProfitTarget("LongHammer", CalculationMode.Ticks, ProfitTarget);
/// SetStopLoss("", CalculationMode.Ticks, StopLoss, false);
SetTrailStop("LongHammer", CalculationMode.Ticks, StopLoss, false);
Add((Bollinger(2, 14)));
CalculateOnBarClose = true;
}
Comment