First post so please be gentle with me!
I have created a simple strategy (chopped-down snippet attached) which goes long when one MA crosses above another MA, and goes short when a third MA crosses below a fourth MA. I understand there is no need to cancel any previous short or long position as the EnterLong or EnterShort will do this automatically.
I am plotting all the MAs and setting CalculateOnBarClose to true in the Initialize method.
I was setting stop and limit in the initialize method as per the example, but this always resulted in a stop and limit being set before the actual trade was made.
Immediately upon starting the strategy, it assumes it has a position, and sets stop and limit orders, but does not make the actual trade. The average price for the position is the price when the strategy is started. This was the same effect I got when setting stop and limit in the Initialize method.
If I manually cancel the stop and limit orders from the chart trader, the strategy seems to be running ok.
Comment