Dear all,

Please find attach the backtest with the code on the following strategy: long-only moving average crossover with trailing stop. Note: it is not possible to short sell on GDAX (unless you have more than $5M), so that explains the long-only.

I had a few questions for you:

- What is the purpose of the clr.AddReference(some_module) after which we import the said module:

import clr
clr.AddReference("System")
clr.AddReference("QuantConnect.Algorithm")
clr.AddReference("QuantConnect.Indicators")
clr.AddReference("QuantConnect.Common")
from System import *
from QuantConnect import *
from QuantConnect.Algorithm import *
from QuantConnect.Indicators import *

- I use the OnOrderEvent(self, event) method. However, I believe it is never executed (despite orders being filled) since I have debug/log messages in this code block that do not appear. Furthermore, since I create the limit stop loss in this method, after backtesting, it seems no stop loss was ever executed despite some huge drawdowns. What should I do for this code block to be executed?

- How would you go setting how the trailing stop price follows the current price? In my mind, the best would be a formula that could set the pace 1 for 1, more than 1 for 1 (with a constraint at some point), less than 1 for 1. I came up with the following formula: 

if currentPrice > self.previousPrice:
ratio = currentPrice / self.previousPrice
adjustedRatio = (ratio + self.follow_factor) / (1 + self.follow_factor)
trigger = decimal.Decimal(self.previousTrigger * adjustedRatio)

- Relative to the QuantConnect Coding Standards (no matter how officious they are ;) ) is there anything in the code that should be improved/changed?

- Relative to the strategy, what would you change or add? The next steps I planned: add a time filter (hourly period during a day), add a breaking out/price confirmation signal (recent high surpassed?), adjust the parameters´ inputs for better performance.

Thank you in advance!