Day Trading Stock Controller Disclaimer: Trading stocks, including ETFs, involves substantial risk of loss and is not suitable for all people. You should carefully consider whether trading, especially day trading, is suitable for you in light of your circumstances, knowledge, and financial resources. You may lose all or more of your capital for trading. This strategy is a tool to do day trading. Even though I have tested the strategy to my satisfaction, I cannot guarantee correct and accurate execution of the strategy in real time trading, real time simulation and backtesting, and I am not responsible in any way for any losses experienced by the strategy users. Detailed Description: This Day Trading Stock Controller, abbreviated to DTSC, does intraday real time trading and real time simulation. It also does backtesting on any user-designated trade day. The DTSC enables its users to automatically control their day trading by providing configurable parameters on their trades. The parameters accept user input to define a trade, such as long or short, technical indicators (MACD, moving average and Stochastic), when to place an order, when to stop placing an order (if not filled), stops and targets, etc. DTSC checks the input values. If it finds problems, the user would be alerted via TradeStation Events Log, and it will stop. DTSC writes informative messages in TradeStation Print Log to explain the errors and how to correct them. An opened position would be closed in one of three ways: The trader s target is met It is closed after trader-designated time It is stopped out per trader-designated stop rule DTSC Page 1 of 23
It is recommended that you run the strategy as is, read the Print Log and the Performance Report, revise the input and run it again to get a feel of how the strategy works. Please read the explanation on the parameters in the document. There are six examples for your reference. They can help you understand and run this strategy easily and productively. Revision History: V3.11: Improving the document Renaming this strategy from Day Trading Stock Manager to Day Trading Stock Controller. The new strategy named Day Trading Stock Manager is available in the Network and has more features than this one Versions 3.4 to 3.10: Various enhancements and improvements to codes and document Version 3.3: First version released to TradeStation Strategy Network To download the strategy, please do: 1. Click the chart where you want the strategy downloaded 2. Right-click and select Insert Strategy 3. In the Insert Strategies pop-up window, click My Strategy Network Subscriptions 4. Select the strategy you want and click OK 5. Format the symbol appropriately. Format the strategy and run it. Installation Requirements: TradeStation 9.1 (Update 12) or later Note: Earlier updates will probably work because this program does not use update specific features and it was tested in some of the earlier updates TradeStation market data subscriptions for equities DTSC Page 2 of 23
Contact: Please email author at tmszeto@yahoo.com if you have any problems, questions or suggestions about this strategy. Your feedback would be greatly appreciated! DTSC Page 3 of 23
General explanation of input values for parameters (data stream 1 is 1 minute) Input Name Input Value Notes RealTme2_BackTest3 2 or 3 BackTest_Date A TradeStation Date 2 for Real time trading or real time simulation 3 for backtesting A past date or today s date after market hours Long2_Short3 2 or 3 2 for long, 3 for short StartTradeTime StopTradeTime CloseTradeTime MarketCloseTime NumberOfShares A TradeStation Time A TradeStation Time A TradeStation Time 1300 (PST) or 1600 (ET) A positive integer Entry_Lmt3_Mk4_SMk5 3 or 4 or 5 EntryPricePerShare StopLoss_SM6_TrlnSM7 StopLossAmtPerShare A positive number 6 or 7 or another digit A positive number At or after the time, an order would be submitted to open a position At or after the time, no order would be submitted to open a new position At or after the time, a market order would be submitted to close a position opened by this strategy in the same session Used by other time related parameters for reference Number of shares for the position 3 for limit order 4 for market order 5 for stop market order Limit or stop market price per share if 3 or 5 is entered in Entry_Lmt3_Mk4_SMk5 Ignored for market order 6 for stop market order 7 for trailing stop market order Another digit means no stop loss order Stop loss amount per share if 6 or 7 is entered in StopLoss_SM6_TrlnSM7 DTSC Page 4 of 23
Target_Amt8_Price9 Target_AorP_PerShare Use_MACD_1 MACD_Over_MACDAvg_1 MACD_FastLength MACD_SlowLength MACD_Length Use_FastMA_SlowMA_1 FastMA_Over_SlowMA_1 8 or 9 or another digit A positive number 1 for true or another digit for false 1 for true or another digit for false 12 (changeable by 26 (changeable by 9 (changeable by 1 for true or another digit for false 1 for true or another digit for false 8 for target amount per share 9 for target price per share Another digit means no target Target amount per share (e.g. 0.6) if 8 is entered in Target_Amt8_Price9 Target price per share (e.g. 30.8) if 9 is entered in Target_Amt8_Price9 1 to use MACD as a requirement for opening a long or short position Another digit to ignore the indicator 1 for checking if MACD is ABOVE MACDAvg Another digit for checking if MACD is BELOW MACDAvg Used if 1 is entered in Use_MACD_1 MACD fast length, used if 1 is entered in Use_MACD_1 MACD slow length, used if 1 is entered in Use_MACD_1 MACD length, used if 1 is entered in Use_MACD_1 1 to use two Moving Averages as a requirement for opening a long or short position Another digit to ignore the indicator 1 for checking if fast moving average is ABOVE slow moving average Another digit for checking if fast moving average is DTSC Page 5 of 23
MA_FastLength MA_SlowLength 5 (changeable by 30 (changeable by BELOW slow moving average Used if 1 is entered in Use_FastMA_SlowMA_1 Fast moving average length, used if 1 is entered in Use_FastMA_SlowMA_1 Slow moving average length, used if 1 is entered in Use_FastMA_SlowMA_1 MA_Price Close The default is close. You can use another price by entering it, e.g. open, high or low Use_StochasticSlow_1 OverBot_N_OverSld_1 Stoch_Length OverSold OverBought SmoothingLength1 1 for true or another digit for false 1 for oversold or another digit for overbought 14 (changeable by 20 (changeable by 80 (changeable by 3 (changeable by 1 to use Stochastic Slow as a requirement for opening a long or short position Another digit to ignore the indicator 1 for checking if SlowK is ABOVE SlowD and SlowK is BELOW OverSold Another digit for checking if SlowK is BELOW SlowD and SlowK is ABOVE OverBought Used if 1 is entered in Use_StochasticSlow_1 Stochastic length, used if 1 is entered in Use_StochasticSlow_1 Oversold, used if 1 is entered in Use_StochasticSlow_1 Overbought, used if 1 is entered in Use_StochasticSlow_1 Used if 1 is entered in Use_StochasticSlow_1. Do not change this value unless you are sure about your change DTSC Page 6 of 23
SmoothingLength2 SmoothingType Stoch_PriceH Stoch_PriceL Stoch_PriceC Print_In_PrintLog_1 3 (changeable by 1 (changeable by High (changeable by Low (changeable by Close (changeable by 1 for true or another digit for false Used if 1 is entered in Use_StochasticSlow_1. Do not change this value unless you are sure about your change Used if 1 is entered in Use_StochasticSlow_1. Do not change this value unless you are sure about your change Used if 1 is entered in Use_StochasticSlow_1. Do not change this value unless you are sure about your change Used if 1 is entered in Use_StochasticSlow_1. Do not change this value unless you are sure about your change Used if 1 is entered in Use_StochasticSlow_1. Do not change this value unless you are sure about your change 1 to print messages in TradeStation s EasyLanguage Print Log Another digit not to print messages in the log It is to your benefit to enter 1 because the log explains user-input errors, which cause termination of the strategy. When you can run the strategy errorfree, you can turn it off. DTSC Page 7 of 23
Example 1 of input values for long (data stream 1 is 1 minute) Input Name Value Notes RealTme2_BackTest3 2 BackTest_Date 1120312 Real time trading or real time simulation Ignored due to real time indicated Long2_Short3 2 Long StartTradeTime 635 StopTradeTime 1245 CloseTradeTime 1255 Start submitting an order to open a position at 6:35 a.m. Stop submitting an order to open a position from 12:45 p.m. to close of market Submit a market order to close the opened position at 12:55 p.m. MarketCloseTime 1300 Market closes at 13:00 NumberOfShares 300 300 shares Entry_Lmt3_Mk4_SMk5 3 Limit order EntryPricePerShare 30.20 Buy at $30.20 or lower per share StopLoss_SM6_TrlnSM7 6 Stop market order StopLossAmtPerShare 0.20 Target_Amt8_Price9 8 Target_AorP_PerShare 0.60 Sell at market if price falls by $0.20 or more below filled price per share before target is met Target amount per share Sell at market if close price rises by $0.60 or more above filled price per share and if position has not been stopped out Use_MACD_1 1 Use MACD as a requirement for opening a position DTSC Page 8 of 23
MACD_Over_MACDAvg_1 1 Check if MACD is ABOVE MACDAvg MACD_FastLength 12 MACD fast length MACD_SlowLength 26 MACD slow length MACD_Length 9 MACD length Use_FastMA_SlowMA_1 1 Use two Moving Averages as a requirement for opening a position FastMA_Over_SlowMA_1 1 Check if fast moving average is ABOVE slow moving average MA_FastLength 5 Fast moving average length MA_SlowLength 30 Slow moving average length Use_StochasticSlow_1 1 Use Stochastic Slow as a requirement for opening a position OverBot_N_OverSld_1 1 Check if SlowK is ABOVE SlowD and SlowK is BELOW OverSold Stoch_Length 14 Stochastic length OverSold 20 Oversold OverBought 80 Overbought Print_In_PrintLog_1 1 Print messages in TradeStation s EasyLanguage Print Log DTSC Page 9 of 23
Example 2 of input values for long (data stream 1 is 1 minute) Input Name Value Notes RealTme2_BackTest3 2 BackTest_Date 1120312 Real time trading or real time simulation Ignored due to real time indicated Long2_Short3 2 Long StartTradeTime 945 StopTradeTime 1545 CloseTradeTime 1555 Start submitting an order to open a position at 9:45 a.m. Stop submitting an order to open a position from 15:45 to close of market Submit a market order to close the opened position at 15:55 MarketCloseTime 1600 Market closes at 16:00 NumberOfShares 500 500 shares Entry_Lmt3_Mk4_SMk5 4 Market order EntryPricePerShare 30.20 Ignored due to market order entered StopLoss_SM6_TrlnSM7 7 Trailing stop market order StopLossAmtPerShare 0.20 Sell at market if price falls by $0.20 or more below filled price or rising price per share before target is met Target_Amt8_Price9 9 Target price per share Target_AorP_PerShare 31.30 Sell at market if close price rises to $31.30 or higher per share and if position has not been stopped out Use_MACD_1 1 Use MACD as a requirement for opening a position MACD_Over_MACDAvg_1 1 Check if MACD is ABOVE MACDAvg MACD_FastLength 12 MACD fast length DTSC Page 10 of 23
MACD_SlowLength 26 MACD slow length MACD_Length 9 MACD length Use_FastMA_SlowMA_1 0 Do not use two Moving Averages as a requirement for opening a position FastMA_Over_SlowMA_1 1 Ignored as 1 is not entered in Use_FastMA_SlowMA_1 MA_FastLength 5 Ignored as 1 is not entered in Use_FastMA_SlowMA_1 MA_SlowLength 35 Ignored as 1 is not entered in Use_FastMA_SlowMA_1 Use_StochasticSlow_1 0 Do not use Stochastic Slow as a requirement for opening a position OverBot_N_OverSld_1 1 Ignored as 1 is not entered in Use_StochasticSlow_1 Stoch_Length 14 Ignored as 1 is not entered in Use_StochasticSlow_1 OverSold 30 Ignored as 1 is not entered in Use_StochasticSlow_1 OverBought 70 Ignored as 1 is not entered in Use_StochasticSlow_1 Print_In_PrintLog_1 1 Print messages in TradeStation s EasyLanguage Print Log DTSC Page 11 of 23
Example 3 of input values for long (data stream 1 is 1 minute) Input Name Value Notes RealTme2_BackTest3 3 Backtesting BackTest_Date 1120308 Backtesting uses historic data on 3/08/2012 Long2_Short3 2 Long StartTradeTime 635 StopTradeTime 1245 CloseTradeTime 1255 Start submitting an order to open a position at 6:35 a.m. Stop submitting an order to open a position from 12:45 p.m. to close of market Submit a market order to close the opened position at 12:55 p.m. MarketCloseTime 1300 Market closes at 13:00 NumberOfShares 500 500 shares Entry_Lmt3_Mk4_SMk5 5 Stop market order EntryPricePerShare 30.30 Buy if price rises to $30.30 or higher per share StopLoss_SM6_TrlnSM7 Any digit other than 6 and 7 No stop loss order StopLossAmtPerShare 0.20 Ignored due to no stop loss order Target_Amt8_Price9 Any digit other than 8 and 9 No target Target_AorP_PerShare 31.00 Ignored due to no target Use_MACD_1 0 Do not use MACD as a requirement for opening a position MACD_Over_MACDAvg_1 1 Ignored as 1 is not entered in Use_MACD_1 MACD_FastLength 12 Ignored as 1 is not entered in Use_MACD_1 MACD_SlowLength 26 Ignored as 1 is not entered in Use_MACD_1 MACD_Length 9 Ignored as 1 is not entered in Use_MACD_1 DTSC Page 12 of 23
Use_FastMA_SlowMA_1 1 Use two Moving averages as a requirement for opening a position FastMA_Over_SlowMA_1 1 Check if fast moving average is ABOVE slow moving average MA_FastLength 10 Fast moving average length MA_SlowLength 30 Slow moving average length Use_StochasticSlow_1 5 Do not use Stochastic Slow as a requirement for opening a position OverBot_N_OverSld_1 1 Ignored as 1 is not entered in Use_StochasticSlow_1 Stoch_Length 14 Ignored as 1 is not entered in Use_StochasticSlow_1 OverSold 30 Ignored as 1 is not entered in Use_StochasticSlow_1 OverBought 70 Ignored as 1 is not entered in Use_StochasticSlow_1 Print_In_PrintLog_1 2 Do not print messages in TradeStation s EasyLanguage Print Log DTSC Page 13 of 23
Example 4 of input values for short (data stream 1 is 1 minute) Input Name Value Notes RealTme2_BackTest3 2 BackTest_Date 1120312 Real time trading or real time simulation Ignored due to real time entered Long2_Short3 3 Short StartTradeTime 635 StopTradeTime 1245 CloseTradeTime 1255 Start submitting an order to open a position at 6:35 a.m. Stop submitting an order to open a position from 12:45 p.m. to close of market Submit a market order to close the opened position at 12:55 p.m. MarketCloseTime 1300 Market closes at 13:00 NumberOfShares 500 500 shares Entry_Lmt3_Mk4_SMk5 3 Limit order EntryPricePerShare 30.20 Sell short at $30.20 or higher per share StopLoss_SM6_TrlnSM7 6 Stop market order StopLossAmtPerShare 0.20 Buy to cover at market if price rises by $0.20 or more above filled price per share before target is met Target_Amt8_Price9 8 Target amount per share Target_AorP_PerShare 0.60 Buy to cover at market if close price falls by $0.60 or more below filled price per share and if position has not been stopped out Use_MACD_1 1 Use MACD as a requirement for opening a position MACD_Over_MACDAvg_1 2 Check if MACD is BELOW MACDAvg DTSC Page 14 of 23
MACD_FastLength 12 MACD fast length MACD_SlowLength 26 MACD slow length MACD_Length 9 MACD length Use_FastMA_SlowMA_1 1 Use two Moving averages as a requirement for opening a position FastMA_Over_SlowMA_1 2 Check if fast moving average is BELOW slow moving average MA_FastLength 5 Fast moving average length MA_SlowLength 15 Slow moving average length Use_StochasticSlow_1 1 Use Stochastic Slow as a requirement for opening a position OverBot_N_OverSld_1 2 Check if SlowK is BELOW SlowD and SlowK is ABOVE OverBought Stoch_Length 14 Stochastic length OverSold 20 Oversold OverBought 80 Overbought Print_In_PrintLog_1 1 Print messages in TradeStation s EasyLanguage Print Log DTSC Page 15 of 23
Example 5 of input values for short (data stream 1 is 1 minute) Input Name Value Notes RealTme2_BackTest3 2 BackTest_Date 1120312 Real time trading or real time simulation Ignored due to real time trading entered Long2_Short3 3 Short StartTradeTime 935 StopTradeTime 1545 CloseTradeTime 1555 Start submitting an order to open a position at 9:35 a.m. Stop submitting an order to open a position from 15:45 to close of market Submit a market order to close the opened position at 15:55 MarketCloseTime 1600 Market closes at 16:00 NumberOfShares 500 500 shares Entry_Lmt3_Mk4_SMk5 4 Market order EntryPricePerShare 30.20 Ignored due to market order indicated StopLoss_SM6_TrlnSM7 7 Trailing stop market order StopLossAmtPerShare 0.20 Cover at market if price rises by $0.20 or more above filled price or falling price per share before target is met Target_Amt8_Price9 9 Target price per share Target_AorP_PerShare 29.50 Cover at market if close price falls to $29.50 or lower per share and if position has not been stopped out Use_MACD_1 1 Use MACD as a requirement for opening a position MACD_Over_MACDAvg_1 2 Check if MACD is BELOW MACDAvg DTSC Page 16 of 23
MACD_FastLength 12 MACD fast length MACD_SlowLength 26 MACD slow length MACD_Length 9 MACD length Use_FastMA_SlowMA_1 3 Do not use two Moving Averages as a requirement for opening a position FastMA_Over_SlowMA_1 2 Ignored as 1 is not entered in FastMA_Over_SlowMA_1 MA_FastLength 5 Ignored as 1 is not entered in FastMA_Over_SlowMA_1 MA_SlowLength 15 Ignored as 1 is not entered in FastMA_Over_SlowMA_1 Use_StochasticSlow_1 1 Use Stochastic Slow as a requirement for opening a position OverBot_N_OverSld_1 6 Check if SlowK is BELOW SlowD and SlowK is ABOVE OverBought Stoch_Length 14 Stochastic length OverSold 20 Oversold OverBought 80 Overbought Print_In_PrintLog_1 1 Print messages in TradeStation s EasyLanguage Print Log DTSC Page 17 of 23
Example 6 of input values for short (data stream 1 is 1 minute) Input Name Value Notes RealTme2_BackTest3 3 Backtesting BackTest_Date 1120309 Use historic data on 3/09/2012 Long2_Short3 3 Short StartTradeTime 635 StopTradeTime 1245 CloseTradeTime 1255 Start submitting an order to open a position at 6:35 a.m. Stop submitting an order to open a position from 12:45 p.m. to close of market Submit a market order to close the opened position at 12:55 p.m. MarketCloseTime 1300 Market closes at 13:00 NumberOfShares 500 500 shares Entry_Lmt3_Mk4_SMk5 5 Stop market order EntryPricePerShare 29.80 Sell short if price falls to $29.80 or lower per share StopLoss_SM6_TrlnSM7 Any number other than 6 and 7 No stop loss order StopLossAmtPerShare 0.20 Ignored due to no stop loss order Target_Amt8_Price9 Any digit other than 8 and 9 No target Target_AorP_PerShare 31.00 Ignored due to no target Use_MACD_1 2 Do not use MACD as a requirement for opening a position MACD_Over_MACDAvg_1 1 Ignored as 1 is not entered in Use_MACD_1 MACD_FastLength 12 Ignored as 1 is not entered in Use_MACD_1 MACD_SlowLength 26 Ignored as 1 is not entered in Use_MACD_1 MACD_Length 9 Ignored as 1 is not entered in Use_MACD_1 DTSC Page 18 of 23
Use_FastMA_SlowMA_1 1 Use two Moving averages as a requirement for opening a position FastMA_Over_SlowMA_1 2 Check if fast moving average is BELOW slow moving average MA_FastLength 5 Fast moving average length MA_SlowLength 20 Slow moving average length Use_StochasticSlow_1 1 Use Stochastic Slow as a requirement for opening a position OverBot_N_OverSld_1 2 Check if SlowK is BELOW SlowD and SlowK is ABOVE OverBought Stoch_Length 14 Stochastic length OverSold 20 Oversold OverBought 80 Overbought Print_In_PrintLog_1 1 Print messages in TradeStation s EasyLanguage Print Log DTSC Page 19 of 23
Reference on Formatting a Symbol on Chart Click and select Format Symbol on chart, click Data1 or Data2 you want to format, and then click Format Settings tab: Select Minute and enter your time interval in Minute Bar, enter a number and select Months Back, check Apply time-based Range setting to all data series, select Local for the Time Zone and click OK. The time entered in DTSC time related parameters should correspond to the time zone selected here. Formatting the symbol with at least 2 months of data before the start date of real time trading/simulation or backtesting. For example, on 5/10/2013, you backtest the strategy on 1120312, you need to format the symbol with 16 months of data. Other tabs: Format them the way you like. The default workspace has one chart. To insert a chart with the strategy in your workspace, you can click on a chart with the strategy, select Copy Window and Paste Window to insert it into the workspace. You can insert your analysis techniques and run other strategies in the same chart as long as they do not interfere with DTSC. DTSC Page 20 of 23
DTSC Page 21 of 23
Reference on Formatting the Strategy 1. Click and select Format Strategies on chart: For real time trading: Check Generate strategy orders for display in TradeManager s Strategy Orders tab, check Automate execution using your account with confirmation (which requires you to select I Agree) and select Off in confirmation (which requires you to select I Agree), only if you do not want TradeStation to ask you for confirmation before placing a real order. For real time simulation: Check only Generate strategy orders for display in TradeManager s Strategy Orders tab and do not check the box under it. 2. Turn on the strategy by clicking Status and the Status column shows On. 3. Click Format tab: Inputs: Enter your trade specific data. Please read the general explanation and six examples for your reference on input. Entries and Exits: Check Show Signal Name, and select your other preferences. Calculation: Do not check Enable intrabar order generation and calculation because this feature is not supported for multi-data-stream charts. The charts have 2 data streams. 4. Click Properties for All tab: General: For simulation and backtesting, enter appropriate values under Costs/Capitalization, such as $0.01 as Commission per Share/Contract and $0.02 as Position Slippage per Share/Contract. DTSC Page 22 of 23
In Back-testing resolution, do not check Use Look-Inside-Bar- Back-testing because 1-minute bar in data1 stream is pretty sensitive to price variations. If your data1 steam uses longer than 1 minute as the interval, you may want to try different values for Use Look-Inside-Bar-Back-testing. Enter 100 in Maximum number of bars study will reference. You may be able to use a smaller number as the maximum number of bars. See note under Settings tab above for more information. Backtesting: Under Limit Order Fill Assumptions, check Fill entire order when trade occurs at limit price or better. Check Enable Intra-bar Order Generation Optimization with Look-Inside-Bar-Back-testing. Automation: Under Strategy fill logic, check Strategy will fill non-historical orders based on price activity and nothing else. For real time trading, check the two boxes under Stop Orders. To stop the strategy when it is running: Click and select Format Strategies on chart Click Status and the Status column shows Off Select Cancel Order in Strategy Automation Warning pop-up window Please note that if a running DTSC, after it has opened a position, is stopped for whatever reason, DTSC has no way to manage it anymore, and you need to manage the position yourself. Thank you for using DTSC! Have happy and profitable trading!! DTSC Page 23 of 23