Jo is back with some more machine learning fun. I will be posting for a few days before leaving again. I am terribly busy with my own trading and coding, so there is not much time for this FF thread. If you're familiarized with this thread you will notice that I just post a few times every few months, when I get the time to do so. I will try to answer questions while I am posting but I will concentrate on showing some more things before leaving.
Last time we were discussing ensembles that were created using strategies with multiple entries and SL+TP structures. This time I want to share another family of machine learning strategies that can be coded using the same philosophy of predicting the trade outcome but this time based on a simple type of trailing stop mechanism, single entries and no TP. This mechanism is different to the ones you will find on Asirikuy today in their machine learning mining (what they call "function based trailing stops") but this mechanism is much simpler and adds no external parameters.
The system trades like this:
Last time we were discussing ensembles that were created using strategies with multiple entries and SL+TP structures. This time I want to share another family of machine learning strategies that can be coded using the same philosophy of predicting the trade outcome but this time based on a simple type of trailing stop mechanism, single entries and no TP. This mechanism is different to the ones you will find on Asirikuy today in their machine learning mining (what they call "function based trailing stops") but this mechanism is much simpler and adds no external parameters.
The system trades like this:
- Trade decisions are only made on a single hour during the trading day (A)
- The machine learning method is retrained every time a decision is made
- If the ML algo predicts a long/short we enter a long/short if no positions are open
- If there is a position open in the same direction then reset the SL as if the position had just been opened
- If there is a position in the opposite direction then stop and reverse
- If a position is open check at the start of every 1H bar whether moving the SL to a distance equal to the initial SL from the current open is more favorable than the current SL. If it is then move the SL to this position.
The ML algo works like this:
- Train the ML algo every time a trading decision is made using a linear regression model. Use the last (B) examples for training.
- Each example is built starting on the same decision hour (A) in the past, using the last (C) hourly returns as inputs
- For the outputs evolve a long and short trade forward a (D) number of bars. This means moving the virtual SL for the trade as specified in the system rules above. Record the trade exit for both and assign each to a separate output. Each example has C inputs and 2 outputs.
This is an example on the EUR/USD:
Inserted Code
SL = 110% daily ATR20 A=8 (I remind you that this is GMT +1/+2) B=260 C=14 D=100
Attached Image