With a new powerful PC and a tested strategy, I’m very close to being in a position to place my first automated trades using ATMs.
The biggest hurdle for me (and looking through the Forum, this has obviously been the case for many others) is to adapt the SampleAtmStrategy for my own purposes. The coding is complex and there seems to be room for a lot of mistakes to creep in.
I’ll paste below some of the code from SampleAtmStrategy. The lines in blue are the ones I have queries about.
1)
Original: if (orderId.Length == 0
&& atmStrategyId.Length == 0
&& Close[0] > Open[0])
Am I right in replacing the above line in blue with, for example (and this isn't a working strategy in any way!) something like:
if (
orderId.Length == 0
&& atmStrategyId.Length == 0
&& MACD(12, 26, 9).Avg[0] > 0
&& MACD(12, 26, 9).Avg[1] <= 0
&& Rising(EMA(16))
)
2)
AtmStrategyCreate(Cbi.OrderAction.Buy,
OrderType.Market, 0, 0, TimeInForce.Day, orderId,
"AtmStrategyTemplate", atmStrategyId);
Am I right in thinking this enters a Buy order at Market and that the “0,0” means this is neither a stop nor limit a order?
3)
I don't fully understand the function of the following if statement and action:
if (atmStrategyId.Length > 0)
{
if (GetAtmStrategyMarketPosition(atmStrategyId) != MarketPosition.Flat)
AtmStrategyChangeStopTarget(0, Low[0] - 3 * TickSize, "STOP1", atmStrategyId);
If the stops are controlled by the ATMs uniquely, what is the function these lines and why invoke AtmStrategyChangeStopTarget?
Thanks very much in advance.
Comment