Hi all,

I've been attempting to produce the Expert Exits systems discussed in the book Trading Systems and Money Management (found here https://books.mec.biz/tmp/books/n9unrfvy3wsqby9tsj1otkpp3r98kq.pdf).

The system rules are:

160699_1645432106.jpg

I've been having a few issues with the system. 

  1. I've found that the stop market order, upon being triggered, is sometimes duplicated to create a short order when the system only should trade longs.
  2. When I changed the def OnOrderEvent to logic, found in the backtest, that seemed to make more sense than the original, which I'll attach in the proceeding post, turns the system from a marginally profitable one into a steaming pile of garbage. The only real change I made was for the system to check that the order event is indeed the market order and to save the fill price from this. 
  3. I am not sure exactly which value from the rolling windows to use as not all values are available at the same time. For example, yesterdays high and the preceeding days high. Since the high for the current day isn't available yet, will yesterdays high still be found at self.highWindow[0]? Or will the system take the current days available high and add it to the rolling window at index[0] when they update in OnData? For clarity, the system runs on minutely data consolidated into a daily bar so that positions can be monitored intraday. 

 

If anyone can assist me with these issues, that would be amazing.

Thanks,

Nick

 

Author