[ Pobierz całość w formacie PDF ]
.Many different processes exist for selecting the optimised parameters.Here are thetwo I use most regularly, in reverse order.Option 1If I only intend the system to run very short-term, perhaps less than three months, orI feel that the system is incomplete and I know that I have several changes and plentyof test cycles ahead, I will often optimise the strategy on the previous 12 month sworth of historic data only.Certainly in the forex markets I have noticed that many short-term patterns tend torepeat frequently, but then fade out over time.By performing a short-termoptimisation, and running the optimised parameters specific to each instrument,rather than a generalised set for the whole basket, I hope to achieve short-term gains.Whilst this strategy is not recommended for long term success it can be profitable inthe very short-term.Choosing this optimisation option requires frequent system changes to be madewhich goes against one of the major principles of creating a robust, long-termstrategy.145System_Trading_271008:Layout 1 28/10/08 10:54 Page 146Systems Trading for Spread BettingWhen developing and optimising any strategy, the system developer will gothrough many cycles of strategy changes and testing.It is very important todocument each cycle and keep a record of what was changed and how thechange influenced the performance metrics observed.Regular reviews of thesechanges/metrics will clearly show the direction your strategy is heading in.Instrument FastEMA SlowMAAUDUSD 6 20CHFJPY 7 24EURCHF 12 26EURGBP 6 22EURJPY 8 24EURUSD 9 20GBPUSD 7 24NZDUSD 12 26USDCAD 12 26USDCHF 3 20USDJPY 12 22Table 13.5 A set of optimisation results for a basket of instrumentsFrom an optimisation we obtained the example optimum parameters in table 13.5.Notice how the optimiser produces different parameters for each instrument, and nota single set of parameters that work well for every instrument.Our challenge here isto do just that.My first step would be to re-run the optimisation process for theprevious 6 or 12 months.Doing so would produce a new set of curve fit parametersindividual to each instrument.Should any metrics obtained be unfavourable, ie, whereno parameters were able to produce a profitable result, or if the optimum parameterswere at the boundary edge, then I would widen the ranges to allow the optimiser moreparameters to choose from.After a final set of parameters is chosen for each instrument, I would trade thestrategy with those specific parameters for a period of no longer than three months.146System_Trading_271008:Layout 1 28/10/08 10:54 Page 147Strategy OptimisationOption 2Use an arithmetic function to select the parameters based on mean, median or mode." The mean, or average, is found by adding all of the results together and dividingthe total by the number of results." The median is the middle value in the list after sorting the list into increasingorder." The mode in a list of numbers refers to the numbers that occur most frequently.Based on our previous optimised results:Instrument FastEMA SlowEMAAUDUSD 6 20CHFJPY 7 24EURCHF 12 26EURGBP 6 22EURJPY 8 24EURUSD 9 20GBPUSD 7 24NZDUSD 12 26USDCAD 12 26USDCHF 3 20USDJPY 12 22Mean 9 23Median 8 24Mode 12 20Table 13.6 The arithmetic mean, median and mode of the optimised parametersAfter calculating the mean, median and mode, we now have reduced the differentcombinations of parameters down to only three.Further backtesting can now beperformed on all three to find the single combination that produces the bestperformance metrics.147System_Trading_271008:Layout 1 28/10/08 10:54 Page 148System_Trading_271008:Layout 1 28/10/08 10:54 Page 14914Strategy Development Putting It All TogetherStrategy IntroductionThe aim of this chapter is to take all of the different components of a strategydiscussed so far and combine them to create an idea for a strategy, develop the ideausing the NinjaTrader strategy wizard, and then backtest and optimise the strategyto end up with a trading system ready for further testing and detailed analysis.We will create a strategy that captures the swing movement of an instrument thatoscillates above and below a long term moving average.When the price action movesabove the long-term average we will enter a long position.A short entry will occurwhen the price action moves below the long-term average.Two short duration exponential moving averages will be used to exit the trade whenthese moving averages crossover.The long term moving average will actually be two moving averages, one based on thehigh price, one based on the low, this forms a high/low price channel.These movingaverages will also act as the stops.For example, when the price action moves throughthe MA of the high, a long position will be opened.Should the price move downbelow the MA of the high and back into the channel we consider the trade to have149System_Trading_271008:Layout 1 28/10/08 10:54 Page 150Systems Trading for Spread Bettinggone against us and an exit is triggered.Basing the stops on a moving average allowsmore flexibility in the trade, but means that the stop size can vary for each trade.Figure 14.1 Demonstrates a trade either side of our price channelFigure 14.1 shows two complete trades using the strategy.The first trade is a shorttrade entered as the price action broke below the low of the channel.The trade exitedwhen the short period EMAs crossed.The second trade is a long position enteredwhen the price action crossed above the high of the channel.The position was closedwhen the EMAs crossed.Strategy High Level DefinitionThe following steps are a high-level description of how the strategy will function.1.Create a channel based on a long duration moving average of the high and lowprices.2.Go long if the close price breaks out above the channel.150System_Trading_271008:Layout 1 28/10/08 10:54 Page 151Strategy Development Putting It All Together3.Go short if the close price breaks below the channel.4.Have two shorter duration moving averages to close the positions as the pricereverses back towards the channel.5.Have an additional technical close for a situation where the price action closesback inside the channel before the shorter duration MAs trigger.Strategy Formula DefinitionOur open and close criteria can be defined as:Position Trigger Formula DescriptionIf the close value of the current barIf Close[0] crosses above SMA(High, crosses above the long period simpleOpen LongChannelPeriod) moving average of the highs, thenopen a long positionIf the FastEMA of the current barIf EMA(FastEMA[0]) crosses below crosses below the SlowEMA of theClose LongEMA(SlowEMA[0]) current bar, then close the longpositionIf the close value of the current barIf Close[0] crosses below SMA(Low, crosses below the long period simpleOpen ShortChannelPeriod) moving average of the lows, thenopen a short positionIf the FastEMA of the current barIf EMA(FastEMA[0]) crosses above crosses above the SlowEMA of theClose ShortEMA(SlowEMA[0]) current bar, then close the shortpositionTable 14.1 Trade entry criteria for the channel crossover strategyIn addition to the above criteria, we will also try to minimise the damage caused bywhipsaws.This can be done by closing open positions if the price action goes againstus before the EMA crossover has occurred [ Pobierz całość w formacie PDF ]
zanotowane.pl doc.pisz.pl pdf.pisz.pl milosnikstop.keep.pl
.Many different processes exist for selecting the optimised parameters.Here are thetwo I use most regularly, in reverse order.Option 1If I only intend the system to run very short-term, perhaps less than three months, orI feel that the system is incomplete and I know that I have several changes and plentyof test cycles ahead, I will often optimise the strategy on the previous 12 month sworth of historic data only.Certainly in the forex markets I have noticed that many short-term patterns tend torepeat frequently, but then fade out over time.By performing a short-termoptimisation, and running the optimised parameters specific to each instrument,rather than a generalised set for the whole basket, I hope to achieve short-term gains.Whilst this strategy is not recommended for long term success it can be profitable inthe very short-term.Choosing this optimisation option requires frequent system changes to be madewhich goes against one of the major principles of creating a robust, long-termstrategy.145System_Trading_271008:Layout 1 28/10/08 10:54 Page 146Systems Trading for Spread BettingWhen developing and optimising any strategy, the system developer will gothrough many cycles of strategy changes and testing.It is very important todocument each cycle and keep a record of what was changed and how thechange influenced the performance metrics observed.Regular reviews of thesechanges/metrics will clearly show the direction your strategy is heading in.Instrument FastEMA SlowMAAUDUSD 6 20CHFJPY 7 24EURCHF 12 26EURGBP 6 22EURJPY 8 24EURUSD 9 20GBPUSD 7 24NZDUSD 12 26USDCAD 12 26USDCHF 3 20USDJPY 12 22Table 13.5 A set of optimisation results for a basket of instrumentsFrom an optimisation we obtained the example optimum parameters in table 13.5.Notice how the optimiser produces different parameters for each instrument, and nota single set of parameters that work well for every instrument.Our challenge here isto do just that.My first step would be to re-run the optimisation process for theprevious 6 or 12 months.Doing so would produce a new set of curve fit parametersindividual to each instrument.Should any metrics obtained be unfavourable, ie, whereno parameters were able to produce a profitable result, or if the optimum parameterswere at the boundary edge, then I would widen the ranges to allow the optimiser moreparameters to choose from.After a final set of parameters is chosen for each instrument, I would trade thestrategy with those specific parameters for a period of no longer than three months.146System_Trading_271008:Layout 1 28/10/08 10:54 Page 147Strategy OptimisationOption 2Use an arithmetic function to select the parameters based on mean, median or mode." The mean, or average, is found by adding all of the results together and dividingthe total by the number of results." The median is the middle value in the list after sorting the list into increasingorder." The mode in a list of numbers refers to the numbers that occur most frequently.Based on our previous optimised results:Instrument FastEMA SlowEMAAUDUSD 6 20CHFJPY 7 24EURCHF 12 26EURGBP 6 22EURJPY 8 24EURUSD 9 20GBPUSD 7 24NZDUSD 12 26USDCAD 12 26USDCHF 3 20USDJPY 12 22Mean 9 23Median 8 24Mode 12 20Table 13.6 The arithmetic mean, median and mode of the optimised parametersAfter calculating the mean, median and mode, we now have reduced the differentcombinations of parameters down to only three.Further backtesting can now beperformed on all three to find the single combination that produces the bestperformance metrics.147System_Trading_271008:Layout 1 28/10/08 10:54 Page 148System_Trading_271008:Layout 1 28/10/08 10:54 Page 14914Strategy Development Putting It All TogetherStrategy IntroductionThe aim of this chapter is to take all of the different components of a strategydiscussed so far and combine them to create an idea for a strategy, develop the ideausing the NinjaTrader strategy wizard, and then backtest and optimise the strategyto end up with a trading system ready for further testing and detailed analysis.We will create a strategy that captures the swing movement of an instrument thatoscillates above and below a long term moving average.When the price action movesabove the long-term average we will enter a long position.A short entry will occurwhen the price action moves below the long-term average.Two short duration exponential moving averages will be used to exit the trade whenthese moving averages crossover.The long term moving average will actually be two moving averages, one based on thehigh price, one based on the low, this forms a high/low price channel.These movingaverages will also act as the stops.For example, when the price action moves throughthe MA of the high, a long position will be opened.Should the price move downbelow the MA of the high and back into the channel we consider the trade to have149System_Trading_271008:Layout 1 28/10/08 10:54 Page 150Systems Trading for Spread Bettinggone against us and an exit is triggered.Basing the stops on a moving average allowsmore flexibility in the trade, but means that the stop size can vary for each trade.Figure 14.1 Demonstrates a trade either side of our price channelFigure 14.1 shows two complete trades using the strategy.The first trade is a shorttrade entered as the price action broke below the low of the channel.The trade exitedwhen the short period EMAs crossed.The second trade is a long position enteredwhen the price action crossed above the high of the channel.The position was closedwhen the EMAs crossed.Strategy High Level DefinitionThe following steps are a high-level description of how the strategy will function.1.Create a channel based on a long duration moving average of the high and lowprices.2.Go long if the close price breaks out above the channel.150System_Trading_271008:Layout 1 28/10/08 10:54 Page 151Strategy Development Putting It All Together3.Go short if the close price breaks below the channel.4.Have two shorter duration moving averages to close the positions as the pricereverses back towards the channel.5.Have an additional technical close for a situation where the price action closesback inside the channel before the shorter duration MAs trigger.Strategy Formula DefinitionOur open and close criteria can be defined as:Position Trigger Formula DescriptionIf the close value of the current barIf Close[0] crosses above SMA(High, crosses above the long period simpleOpen LongChannelPeriod) moving average of the highs, thenopen a long positionIf the FastEMA of the current barIf EMA(FastEMA[0]) crosses below crosses below the SlowEMA of theClose LongEMA(SlowEMA[0]) current bar, then close the longpositionIf the close value of the current barIf Close[0] crosses below SMA(Low, crosses below the long period simpleOpen ShortChannelPeriod) moving average of the lows, thenopen a short positionIf the FastEMA of the current barIf EMA(FastEMA[0]) crosses above crosses above the SlowEMA of theClose ShortEMA(SlowEMA[0]) current bar, then close the shortpositionTable 14.1 Trade entry criteria for the channel crossover strategyIn addition to the above criteria, we will also try to minimise the damage caused bywhipsaws.This can be done by closing open positions if the price action goes againstus before the EMA crossover has occurred [ Pobierz całość w formacie PDF ]