I’ve been creating a backtesting strategy where a new entry order is generated once an existing trade is stopped out. I’ve set it up so the very first entry is assigned to an object, and when the trade exits at either its target or protective stop, the object is set to null, and if the exit was a stop-out, the same object is assigned another entry order (at a price that's some distance from that stop-out). I’m using the very same line of code for the second entry order as the first one; however, when ran, NT either crashes or endlessly loops (frozen app, maxed CPU, nothing in the output window).
Strange thing is, in the second entry assignment, if I substitute plain static numbers for the variables used for the limit and stop values, it doesn’t crash. The first entry assignment happens in the OnBarUpdate block, and I’ve tried the second one in the OnPositionUpdate and OnExecute blocks with the same crash behavior.
Comment