leakywaders
New member
HI to all!
Thanks in advance for the help! This website has been truly great and my apologies for not not contributing more. I try to give back what I have gotten from here but I'm just so busy with 2 jobs, and an 18 month old son, and my mother was recently diagnosed with cancer and is just about to start chemo. I just never have time to post as much as I'd like here but I do have some killer algorithms and strategies that work very well. I'll try to contribute more in the future and I've posted my strategy below in the 7th paragraph with an example from today in the next paragraph..
Today even though I'm not trading my system worked perfectly. I would have shorted SPY at the hourly 9 ema retest at 10:30ish at $293.72. I always have the hourly 9ema plotted on all my intraday charts and that is the backbone of my strategy. I achieve $1-3 dollars of net price movement per day in 1-5 trades. There is always a trade everyday with my strategy. So for example today SPY was trending above the hourly 9 ema premarket, it broke through its hourly 9 ema trend at 9:41 (no trade), it crossed back above its 9 ema at 10:00am (no trade), it broke again lower at 10:17 (no trade but sometimes I trade if it breaks the hourly and if it puts in a lower high relative to premarket), but then it retests the hourly 9 ema trend and rejected it at 10:30 for an immediate A+ pattern short - that is my bread and butter low risk trade. It is very close to a stop out point if if fails, has a high probability of succeeding, and high profit ratio.
My question is that I've been having problems building some think or swim strategies that only buy/sell during regular hours along with multiple time frame strategies. My backtesting strategies seem to break if I add a regular trading hours time filter. I have many indicators and custom scripts that work for regular trading hours that use things like:
def trading_day = getTime() >= RegularTradingStart(getYYYYMMDD()) and
getTime() <= RegularTradingEnd(getYYYYMMDD());
plot signal = if trading_day then xxxxxx;
But the above logic for some reason doesn't seem to work in my strategy builds nor selling EOD or buy BOD - really anything time based. I"m also having problems with backtesting multiple time frame strategies but I've worked around that by approximating moving averages of the multiple timeframes instead of using the close(getagg...) function. That also allows my indicator to work on mobile. However it is not the same as using the actual stair stepped higher timeframe moving averages but it's good enough for TOS for now. Also having afterhours turned on and aggregating during AH is important to my strategy.
Does anyone have a strategy that I can use as a template that buy/sells only during regular trading hours? I want to back test my custom algorithmic MTF option strategy but it needs to be limited to trade only during regular hours (when options trading is available) and also sell at EOD regardless of what my algo says. The net dollar P/L I am just going to convert into option strikes and delta to calculate true options P/L unless there is code that works with TOS strategies that automatically gets an option strike (get a $1 OTM option, 3 days <stike expiration<7 days) instead of the buying/seling SPY itself. But either way, I can back calculate the true P/L from the net dollar change.
My strategy is pretty straight forward. I place directional trades (buy to open calls and puts) with the hourly 9ema trend, up or down. and buy bounces, long or short, counting the bounces along the way. If the hourly 9 ema bounce count is greater than 2 then I buy directional bounces(long and short) at the hourly 9ema and sell it at the break of the 5 min 9 ema cross. If it breaks through the hourly 9 ema trend I have to wait for a retest of the hourly 9 ema. If it is below the hourly I will play every short bounce in the direction of the hourly trend but the bounce count has to be greater than 2 (break through hourly and a retest) and vice versa. I also have Trailing ATR filters, volatility filters, EMA crossovers filters, squeeze filters, and trend momentum filters but they just confirm my simple strategy. I have a custom histogram I built using this logic that gives buy and sell signals with high accuracy and good win/loss profit ratio. I don't trade with the daily trend as I capture more intraday movement trading the hourly trend which almost always exists and allows more trading opportunities. But I do trade in the direction of the hourly trend and buy only in that direction. It has worked well in the past and continues to work well through this chop in the market However I never hold overnight so I miss out on some massive SPY afterhour moves. I'm looking to change that and the first step is to backtest my current strategy with and without overnight holds and also backtest the same strategy by bumping up the time frames for overnight and swing hold periods(e.g instead of hourly, 15 and 5 min 9emas - change to weekly, daily, 4 hour 9 emas).
I am also looking to backtest a buy at close sell at open with some additional parameters similar to above to scalp gamma and volatility. So if anyone has a TOS strategy that a)only trades during regular hours but uses premarket data, b)uses multiple time frames and/or bonus c) uses a optionPrice(getstrike()) function I would greatly appreciate it! I can take that example and insert my strategy into it. If anyone wants to code this strategy since it's simple and I'm sharing it then please feel free to do it and share!
I have great success when trading in front of my desk intraday but am looking for longer term strategies that take less work or to algorithmically auto trade my current strategy. Honestly based on what I've coded, an algorithmic version of my strategy would do better as there are no emotions involved and it's not constrained by tiredness or me having to be hyper vigilant. That is how much I trust my signals and I know my coded version is not only in alignment but actually executes my strategy to it's fullest. Every time I step away to go take a leak, walk away from my desk, working my other job, or watching my son and I'll get a signal (or type this post haha). Or sometimes. even with my level of experience, emotions get the best of me and I don't trade signals that are valid and also end up selling too early. The human side of my trading is my biggest weakness - something that I am always striving to improve.
Also In general despite my alog and strategy being solid, unfortunately TOS is not the best for this due to the recursion and MTF limitations and no real auto buying that I would trust. I'm working on building a fully automated quant system in the future, as I've reached my the limitations of TOS, but I am trying to get above the $100K threshold first before I spend time building my algo. Even MTF text alerts don't work correctly and are delayed by minutes so I'm kind of stuck at my desk trading doing a poorer job than my algo would even with being at my desk hehe. I've spend many hours customizing TOS but I've hit it's limits I think. If I knew about these TOS limitations I would have spent those hundreds of hours coding on something that didn't have these limitations.
No trading for me today! Going to have a nice 4 day holiday week but looking to do some backtest during over the weekend. Got to run!
Here is a picture of the simple strategy in action. Just a simple hourly trend following system - purple dashed line is the hourly 9 ema. Entry is shown. The green dashed line is the daily 50Ema. Covering would have been at the break of the 5 min 9 ema. Since its so far below the hourly I would play a counter trend bounce back up to the 15 min 9 ema target, then hourly 9 ema target (if the risk reward was there) and then the following rejection back down short or then wait for a count of 2 if it crosses back up above the hourly. The counting of bounces and breakthroughs of the MTF 9 EMA's helps with making those decisions with my algo. If was watching it I would have shorted earlier but the system is simple reliable and if it executes automatically good enough for me:
Thanks!
Dan
Thanks in advance for the help! This website has been truly great and my apologies for not not contributing more. I try to give back what I have gotten from here but I'm just so busy with 2 jobs, and an 18 month old son, and my mother was recently diagnosed with cancer and is just about to start chemo. I just never have time to post as much as I'd like here but I do have some killer algorithms and strategies that work very well. I'll try to contribute more in the future and I've posted my strategy below in the 7th paragraph with an example from today in the next paragraph..
Today even though I'm not trading my system worked perfectly. I would have shorted SPY at the hourly 9 ema retest at 10:30ish at $293.72. I always have the hourly 9ema plotted on all my intraday charts and that is the backbone of my strategy. I achieve $1-3 dollars of net price movement per day in 1-5 trades. There is always a trade everyday with my strategy. So for example today SPY was trending above the hourly 9 ema premarket, it broke through its hourly 9 ema trend at 9:41 (no trade), it crossed back above its 9 ema at 10:00am (no trade), it broke again lower at 10:17 (no trade but sometimes I trade if it breaks the hourly and if it puts in a lower high relative to premarket), but then it retests the hourly 9 ema trend and rejected it at 10:30 for an immediate A+ pattern short - that is my bread and butter low risk trade. It is very close to a stop out point if if fails, has a high probability of succeeding, and high profit ratio.
My question is that I've been having problems building some think or swim strategies that only buy/sell during regular hours along with multiple time frame strategies. My backtesting strategies seem to break if I add a regular trading hours time filter. I have many indicators and custom scripts that work for regular trading hours that use things like:
def trading_day = getTime() >= RegularTradingStart(getYYYYMMDD()) and
getTime() <= RegularTradingEnd(getYYYYMMDD());
plot signal = if trading_day then xxxxxx;
But the above logic for some reason doesn't seem to work in my strategy builds nor selling EOD or buy BOD - really anything time based. I"m also having problems with backtesting multiple time frame strategies but I've worked around that by approximating moving averages of the multiple timeframes instead of using the close(getagg...) function. That also allows my indicator to work on mobile. However it is not the same as using the actual stair stepped higher timeframe moving averages but it's good enough for TOS for now. Also having afterhours turned on and aggregating during AH is important to my strategy.
Does anyone have a strategy that I can use as a template that buy/sells only during regular trading hours? I want to back test my custom algorithmic MTF option strategy but it needs to be limited to trade only during regular hours (when options trading is available) and also sell at EOD regardless of what my algo says. The net dollar P/L I am just going to convert into option strikes and delta to calculate true options P/L unless there is code that works with TOS strategies that automatically gets an option strike (get a $1 OTM option, 3 days <stike expiration<7 days) instead of the buying/seling SPY itself. But either way, I can back calculate the true P/L from the net dollar change.
My strategy is pretty straight forward. I place directional trades (buy to open calls and puts) with the hourly 9ema trend, up or down. and buy bounces, long or short, counting the bounces along the way. If the hourly 9 ema bounce count is greater than 2 then I buy directional bounces(long and short) at the hourly 9ema and sell it at the break of the 5 min 9 ema cross. If it breaks through the hourly 9 ema trend I have to wait for a retest of the hourly 9 ema. If it is below the hourly I will play every short bounce in the direction of the hourly trend but the bounce count has to be greater than 2 (break through hourly and a retest) and vice versa. I also have Trailing ATR filters, volatility filters, EMA crossovers filters, squeeze filters, and trend momentum filters but they just confirm my simple strategy. I have a custom histogram I built using this logic that gives buy and sell signals with high accuracy and good win/loss profit ratio. I don't trade with the daily trend as I capture more intraday movement trading the hourly trend which almost always exists and allows more trading opportunities. But I do trade in the direction of the hourly trend and buy only in that direction. It has worked well in the past and continues to work well through this chop in the market However I never hold overnight so I miss out on some massive SPY afterhour moves. I'm looking to change that and the first step is to backtest my current strategy with and without overnight holds and also backtest the same strategy by bumping up the time frames for overnight and swing hold periods(e.g instead of hourly, 15 and 5 min 9emas - change to weekly, daily, 4 hour 9 emas).
I am also looking to backtest a buy at close sell at open with some additional parameters similar to above to scalp gamma and volatility. So if anyone has a TOS strategy that a)only trades during regular hours but uses premarket data, b)uses multiple time frames and/or bonus c) uses a optionPrice(getstrike()) function I would greatly appreciate it! I can take that example and insert my strategy into it. If anyone wants to code this strategy since it's simple and I'm sharing it then please feel free to do it and share!
I have great success when trading in front of my desk intraday but am looking for longer term strategies that take less work or to algorithmically auto trade my current strategy. Honestly based on what I've coded, an algorithmic version of my strategy would do better as there are no emotions involved and it's not constrained by tiredness or me having to be hyper vigilant. That is how much I trust my signals and I know my coded version is not only in alignment but actually executes my strategy to it's fullest. Every time I step away to go take a leak, walk away from my desk, working my other job, or watching my son and I'll get a signal (or type this post haha). Or sometimes. even with my level of experience, emotions get the best of me and I don't trade signals that are valid and also end up selling too early. The human side of my trading is my biggest weakness - something that I am always striving to improve.
Also In general despite my alog and strategy being solid, unfortunately TOS is not the best for this due to the recursion and MTF limitations and no real auto buying that I would trust. I'm working on building a fully automated quant system in the future, as I've reached my the limitations of TOS, but I am trying to get above the $100K threshold first before I spend time building my algo. Even MTF text alerts don't work correctly and are delayed by minutes so I'm kind of stuck at my desk trading doing a poorer job than my algo would even with being at my desk hehe. I've spend many hours customizing TOS but I've hit it's limits I think. If I knew about these TOS limitations I would have spent those hundreds of hours coding on something that didn't have these limitations.
No trading for me today! Going to have a nice 4 day holiday week but looking to do some backtest during over the weekend. Got to run!
Here is a picture of the simple strategy in action. Just a simple hourly trend following system - purple dashed line is the hourly 9 ema. Entry is shown. The green dashed line is the daily 50Ema. Covering would have been at the break of the 5 min 9 ema. Since its so far below the hourly I would play a counter trend bounce back up to the 15 min 9 ema target, then hourly 9 ema target (if the risk reward was there) and then the following rejection back down short or then wait for a count of 2 if it crosses back up above the hourly. The counting of bounces and breakthroughs of the MTF 9 EMA's helps with making those decisions with my algo. If was watching it I would have shorted earlier but the system is simple reliable and if it executes automatically good enough for me:
Thanks!
Dan