Still under active development and highly experimental. A polynomial regression channel trading system loosley based upon Mostafa Belkhayate's trading system. Uses the BelkahayatePRC and Hull Moving Average custom indicators (versions used are included - please remember to install and compile them and update the inclusion references in the Golden Dragon before compiling the bot). Many additional functions have been included to facilitate fine-tuning. This can be traded on anything from a 1 minute chart upwards. I've found 5-15 minute chart periods tend to work best.
Remember to update the two references in this robot before compiling it for the first time.
It will not work if it cannot find the compiled custom indicators.
UPDATED to v1.3 - Slight logic change to avoid concurrent martingales. Updated parameter defaults to those which I use as a benchmark starting point when testing new charts (normally 5 minute).
Dragon Number - Used to track trades associated with a Dragon instance. Only required if running multiple instances on the same instrument. Assign a unique number to each. [ Default = 1 ]
COG Degree - Degree for the polynomial regression centre-of-gravity line. A setting of 1 uses a linear regression. 2-4 produce progressively tighter fitting curves [ Default = 3, Range = 1-4, Typically = 3-4 ]
COG Period - Number of bars that the polynomial regression should be calculated over. [ Default = 260 ]
1st Channel Offset - Offset distance for the first (inner) channel lines. These lines may be optionally used as target lines for trades. [ Default = 1.4 ]
2nd Channel Offset - Offset distance for the second (intermediate) channel lines. These lines are used for trade entry selection and may be optionally used as target lines for trades originating on the opposite side of the centreline. [ Default = 2.4 ]
3rd Channel Offset - Offset distance for the third (outer) channel lines. These lines are used for trade entry selection and may be optionally used as target and/or stop loss lines for trades. [ Default = 3.4 ]
COG Trade Biasing - When enabled, trades are filtered according to whether the COG is rising (long trades only) or falling (short trades only). [ Default = No ]
Adaptive Trade Biasing - When enabled, the maximum permitted number of long and short trades will be automatically adjusted based on performance. If a long trade is lost then the maximum number of long trades will be decremented by 1 and the maximum number of short trades will be increased by 1 (up to the specified maximum), and vica-versa. [ Default = No ]
Hull Trade Biasing - Uses a Hull Moving Average to filter trade entry direction. If enabled, will only enter long positions if the HMA is rising, and short positions if it is falling. [ Default = Yes ]
Hull Period - Hull Moving Average period in bars. The HMA is used to aid trade entry timing. Long trades are entered when the HMA passes upwards through either of the lowest two channel lines (and price is within the Entry Window distance above the entry line). Short trades are entered when the HMA passes downwards through either of the uppermost two channel lines (and price is within the Entry Window distance below the entry line). Longer HMA periods result in more reliable entry points, but reduced profit per trade due to later entry. [ Default = 5, Typical Range = 4 - 10 ]
ATR Filter 1| 2 Period - If both of these are non-zero, then trades will only be opened when the ATR1 value is lower than ATR2. Acts as a volatility filter. [ Default = 0 | 0 ]
ATR Filter 1| 2 MA Type - Specify the type of smoothing to be used for each of the average true range indicators. [ Default = Simple | Simple ]
Long Trades - Maximum number of long positions which may be simultaneously opened. Higher values increase both profitability and risk. Some markets trade profitably in one direction only. [ Default = 1, Off = 0 ]
Short Trades - Maximum number of short positions which may be simultaneously opened. Higher values increase both profitability and risk. Some markets trade profitably in one direction only. [ Default = 1, Off = 0 ]
Buy Wait - Minimum number of bars to wait between entering trades. Used primarily to prevent trade "bunching" and manage risk levels. [ Default = 20, Off = 0 ]
Buy Wait on Loss - Additional number of bars to wait after losing a trade. New trades will not be entered until the wait period is complete. Useful for dealing with occasional high-volatility. Allows the market time to settle before resuming trading. Values slightly higher than the COG period seem to work quite well. [ Default = 260 ]
Stop Loss - Fixed stop loss position relative to trade entry points. [ Default = 100 pips ]
Target Level - Specifies which of the polynomial regression channels will be used for setting the trade targets. By default the centreline (0) will be used, but any of them may be specified, with the 1st channel line on the opposite side from entry being 1, and the 3rd channel line on the opposite side from entry being 3. Higher numbers result in greater proftability and greater risk. [ Default = 0 (centre), Range = -1, 0, 1, 2, 3 ]
Dynamic Targets - Enabling this will causes the targets for open trades to be adjusted to track the specified Target Level with each new bar. Overrides the default fixed target. Useful in some rare circumstances. [ Default = No ]
Opening Lot Size - Starting order volume per trade. If the Money Management or Martingale functionality is enabled then this specifies the minimum trade volume allowed. [ Default = 10000 ]
Maximum Lot Size - Maximum lot that can be placed on any one trade. Zero disables. [ Default = 0 ]
Minimum Profit - Specifies the minimum number of pips to be won on any trade. Trades with dynamic targets will be automatically closed if the target price moves within the minimum profit specified here. [ Default = 1 ]
Maximum Slippage - Specifies the spread allowable per trade entry. [ Default = 2, Attempt Limit Order = 0 ]
Entry Window - Minimum distance (in pips) that price must be from an entry line before a trade can be entered. This has been added to compensate for the entry lag created by the Hull moving average. Trades are no longer entered immediately when the HMA crosses an entry line - the bot will wait for price to be within the Entry Window distance of the entry channel line before opening the trade. Smaller values here will reduce the number of trades entered, but will also increase average profit per trade. [ Default = 5, Range >= 0 ]
Dynamic Stops - Stop Loss positions are dynamically adjusted to track the relevant 3rd channel line on every bar. Seldom of use, but may be useful in some configurations. [ Default = No ]
Trailing Stops - Enables trailing stops. [ Default = No ]
Trailing Stop Trigger - Distance in pips that price must move from entry before the trailing stop is enabled. [ Default = 20 ]
Trailing Stop Distance - Distance from the current price (in pips) for a triggered trailing stop. [ Default = 20 ]
Balance Stop Loss - Proportion of account balance that must be maintained after a loss. Any losses which cause the account balance to drop below this threshhold will result in all losing trades to be closed immediately to preserve the account balance at the current level. For example, if this is set to 0.5, the current account balance is $1000, all losing positions will be closed immediately and the Dragon will exit if the account balance drops below $1000x0.5 = $500 on close of any trade. [ Default = 0.5, Range = 0-1 ]
Equity Stop Loss - If account equity drops below this proportion of the account balance, then all losing open trades are closed immediately and the Dragon will exit. [ Default = 0.5, Range = 0-1 ]
Equity Trade Filter - Will prevent any new trades from being entered into whilst account equity is less than this proportion of the account balance. [ Default = 0.5, Range = 0-1 ]
Trade on Fridays - Does exactly what it says. Provides a means to prevent the opening of new trades on Fridays. Useful in some markets which frequently gap when markets open on a Monday. [ Default = Yes ]
Money Management - Will proportionally increase lot sizes based upon account equity, ie. if the account equity at start of trade is $1000 and the lot size is 10k, then the lot size will be incremented to 20k when the equity reaches $2000, to 30k at $3000, and so on. [ Default = Yes ]
Martingale Enabled - Specifies whether the Martingale-derived loss recovery strategy will be used. This can be extremely succesful because of the high win proportion achievable. When the bot is stopped, either manually or automatically, the current martingale level is saved to a text file in the user's default documents folder (so that the bot can be restarted without "forgetting" it's martingale duties). The level will be restored on start up. Delete or edit the file to reset or preset the martingale level. [ Default = Yes ]
Reversingale Enabled - Enables instant position reversals upon lost trades. Ignores the Buy Wait and Buy Wait on Loss periods altogether. Uses the Martingale Multiplier to calculate the lot size and target distance required in order to recover from a loss. Only works if the Martingale functionality is enabled. Particularly useful in markets (such as gold) that tend to make large rapid moves after long periods of consolidation. [ Default = No ]
Martingale Multipler - When a trade is lost, then the next trade will increase the lot size by the factor specified by this parameter. eg. if the Multiplier is 2, then the lot size will be doubled and the target distance will be roughly half of the lost pips. If set to 4, then the lot size will be quadrupled and the target distance will be roughly one quarter of the lost pips. [ Default = 2 ]
Martingale Recursions - Limit the number of times that consecutive Martingale multiplications may occur. [ Default = 2 ]
Debug Level - Specifies the amount of operational information that will be output to the log. [ Default = 0, Range = 0-2 ]
Together, all of these parameters make for a flexible trading system which has the potential to achieve relatively steady profitability with minimal drawdown in every market that I've tested it on. That said, it can take A LOT of backtesting to tune it to a particular market. Have fun, and please share your profitable parameters, bug fixes, optimizations, enhancements or improvements. This is my first time working with C#, so I'm sure there are plenty of areas which can be optimized.
/ / # r e f e r e n c e : . . \ I n d i c a t o r s \ H u l l M o v i n g A v e r a g e . a l g o / / # r e f e r e n c e : . . \ I n d i c a t o r s \ B e l k h a y a t e P R C . a l g o / / G o l d e n D r a g o n v 1 . 3 / / R e l e a s e d 2 0 t h O c t o b e r 2 0 1 3 / / C r e a t e d b y C r a i g S t o n e ( e x c e p t f o r t r a i l i n g s t o p s c o d e w h i c h i s d r a w n f r o m S p o t w a r e '