/******************************************************************************************************* Title: MA Crossover Trading System for eSignal By: Divergence Software, Inc. Web: http://www.sr-analyst.com ======================================================================================================== Project Description: This indicator is a backtestable trading system based on moving average crossovers. When the fast moving average crosses above or below the slow moving average on bar close a signal is generated and a trade (i.e., Long or Short) is entered at the open of the next bar. The system will also generate new signals/alerts when run in realtime. Based on your account size and risk settings, the system will calculate the correct number of shares/contracts for each trade. You can also select a fixed number of shares/contracts if desired. Performance statistics are integrated into the display but they can be turned off if needed. The system will operate in a chart or in a watchlist. When loaded into a watchlist the statistics will be displayed for each symbol, making this a powerful tool for analyzing the system performance over a large basket of securities. And if/when you make changes to the system settings, the performance stats will be instantly updated in the watchlist. Once you find the system settings that yield the best performance in your basket of securities you can then fine-tune by running individual backtests using the eSignal integrated backtester. A trailing stop system (similar to SuperTrend) is fully integrated. Fixed profit targets (based on either points or a percentage of price) can be activated if desired, and sessions can be defined for intraday usage. If sessions are turned on the Close-All-Trades time specified must be a timestamp that exists on the intraday chart that you are using. Indicator Parameters: ==================== Initial Account Size: Set the size of the account for testing purposes. The default is $100,000. Risk (%): Set the maximum risk per trade. The number of shares/contracts for each trade will be automatically calculated using Risk and Account size. The default Risk is 0.5% (1/2 of 1%). So, assuming a %100,000 account then the number of shares calculated would introduce a maximum risk of $500. Note that the account balance is updated after each trade to take into account the running PL. Brokerage: Set the Brokerage costs as a percentage of share/contract price. This is subtracted from the available account balance when calculating total shares/contracts for a trade. The default is 0.05%. Point Value: Set the $ value of a 1-point move in the security you are testing. The default is $1, which is correct for all US stocks. Note, when you are using this system in a watchlist to evaluate a large basket of securities, be sure that all symbols in that watchlist share the same Point Value. Auto-Calc Contracts?: Check this box if you want the system to auto-calculate the correct number of shares/contracts for each trade based on the Risk and available capital in the Account. If not checked then a fixed number of shares/ contracts will be used for each trade. The default is checked. Fixed Contracts: Specify the number of shares/contracts to use if Auto-Calc above is not checked. The default is 100. Subtract Brokerage Fees?: Check this box to subtract the calculated brokerage fees from the PL of each trade, which will be reflected in the statistics. The default is unchecked. Show Stats?: Check this box to display the performance statistics in the eSignal Cursor Window. The default is checked. Note that when run in a watchlist the statistics will always be displayed. Fast MA Period: The period to use for the fast moving average. Default is 10. Source: The price source to use. Default is close. Select from open, high, low, close, hl2, hlc3, and ohlc4. Type: The moving average calculation to use. Select from sma, ema, wma, vwma, hma, lsma, and triangular. Color: Select the color to use when plotting the fast moving average line. The default is green. Thickness: Select the thickness for the plot. Default is 2. Valid range is 1 to 10. Line Type: Line type to use when drawing the plot. Select from Solid, Dot, Dash, DashDot and DashDotDot. Default is Solid. Slow MA Period: The period to use for the slow moving average. Default is 45. Source: The price source to use. Default is close. Select from open, high, low, close, hl2, hlc3, and ohlc4. Type: The moving average calculation to use. Select from sma, ema, wma, vwma, hma, lsma, and triangular. Color: Select the color to use when plotting the fast moving average line. The default is blue. Thickness: Select the thickness for the plot. Default is 2. Valid range is 1 to 10. Line Type: Line type to use when drawing the plot. Select from Solid, Dot, Dash, DashDot and DashDotDot. Default is Solid. Stop Color: Select the color to use when plotting the stop line. Default is red. Target Color (if used): Select the color to use when plotting the target line. Default is teal. Long/Cover Signal Color: Select the color to use when drawing Long or Cover signals on the chart. Default is lime. Short/Sell Signal Color: Select the color to use when drawing Short or Sell signals on the chart. Default is red. Use Sessions?: Select true or false. If true, and if the chart you are using is based on an intraday interval, then the session times that you specify will be used to control when trades are taken. Please note that intraday boundaries cannot be crossed, and End Time must be greater than Start Time, and Close-All-Trades Time must be greater than End Time. Session Start Time: Specify the start time for trades to be taken on each new day. Must be entered as HH:MM in 24-hour format. Default is 09:30. Session End Time: Specify the end time for trades to be taken on each new day. So no new trades will be taken after this time. Must be entered as HH:MM in 24-hour format. Default is 15:00. Close-All-Trades Time: Specify the time of day at which any open trade should be closed. Must be entered as HH:MM in 24-hour format. Default is 15:55. Note that the time that you choose as the Close-All-Trades time must exist (as a bar timestamp) in the bar interval you are using. Use Target?: Select true or false. If true then a fixed profit target will be placed whenever a new trade is entered. Target/Stop Logic: Select from "Use Points" and "Use Percentage". If "Use Points" is selected then the values that you input for Stop and Target (below) will be treated as points. If "Use Percentage" is selected then the values you input for Stop and Target will be treated as percentages. Target (Points or %): Input the profit target amount. This value will be treated as either points or as a percentage based upon your selection in the Target/Stop Logic field above. ATR Stop Period: Select the period to use for calculating the ATR. Default is 15. # of ATRs: Select the number of ATRs to use when calculating the stop. The default is 2.0. Ratchet %: Set the value, as a percentage, for the stop ratchet mechanism. This mechanism will draw the stop closer to price at an increasing rate as new bars come in. Default is 0.005. Text Font Size (4-55): Select the font size to use for displaying trade signals on the chart. Default is 8. Use Sound Alerts?: Select true or false. Set this option to true to generate a sound alert whenever a signal is generated. Use Popup Alerts?: Select true or false. Set this option to true to generate a popup alert whenever a signal is generated. Use Email Alerts?: Select true or false. Set this option to true to generate an email alert whenever a signal is generated. Note that you must first configure your email settings using the eSignal Alerts Edit/Status Dialog off of the eSignal "View" menu in eSignal 10.x (or in the Application Properties section in eSignal 12.x). Alert WAV File: Use this option to set the WAV file that will play when a Sound Alert is triggered for a trade signal. Any sound file that exists in your eSignal Sound Files Root directory can be entered here. Remember to use the ".WAV" extension. Disclaimer: For educational purposes only! Obviously, no guarantees whatsoever and use at your own risk. *******************************************************************************************************/