OPEN-SOURCE SCRIPT

3 Candle Strike Stretegy

Updated
Mainly developed for SPY trading on 1 min chart. But feel free to try on other tickers.

Basic idea of this strategy is to look for 3 candle reversal pattern within trending market structure. The 3 candle reversal pattern consist of 3 consecutive bullish or bearish candles,
followed by an engulfing candle in the opposite direction. This pattern usually signals a reversal of short term trend. This strategy also uses multiple moving averages to filter long or short
entries. ie. if the 21 smoothed moving average is above the 50, only look for long (bullish) entries, and vise versa. There is option change these moving average periods to suit your needs.
I also choose to use Linear Regression to determine whether the market is ranging or trending. It seems the 3 candle pattern is more successful under trending market. Hence I use it as a filter.

There is also an option to combine this strategy with moving average crossovers. The idea is to look for 3 candle pattern right after a fast moving average crosses over a slow moving average.
By default , 21 and 50 smoothed moving averages are used. This gives additional entry opportunities and also provides better results.

This strategy aims for 1:3 risk to reward ratio. Stop losses are calculated using the closest low or high values for long or short entries, respectively, with an offset using a percentage of
the daily ATR value. This allows some price fluctuation without being stopped out prematurely. Price target is calculated by multiplying the difference between the entry price and the stop loss
by a factor of 3. When price target is reach, this strategy will set stop loss at the price target and wait for exit condition to maximize potential profit.

This strategy will exit an order if an opposing 3 candle pattern is detected, this could happen before stop loss or price target is reached, and may also happen after price target is reached.

*Note that this strategy is designed for same day SPY option scalping. I haven't determined an easy way to calculate the # of contracts to represent the equivalent option values. Plus the option
prices varies greatly depending on which strike and expiry that may suits your trading style. Therefore, please be mindful of the net profit shown. By default, each entry is approximately equal
to buying 10 of same day or 1 day expiry call or puts at strike $1 - $2 OTM. This strategy will close all open trades at 3:45pm EST on Mon, Wed, and Fri.

**Note that this strategy also takes into account of extended market data.

***Note pyramiding is set to 2 by default, so it allows for multiple entries on the way towards price target.

Remember that market conditions are always changing. This strategy was only able to be back-tested using 1 month of data. This strategy may not work the next month. Please keep that in mind.

Also, I take no credit for any of the indicators used as part of this strategy.

Enjoy~
Release Notes
Fixed bugs:
  • SL and PT displayed on entry signal was incorrect. SL/PT replaced by red and green lines on chart with filled area.
  • "No long entry at 10am" option wasn't working properly. Fixed.
  • Open trades weren't exiting at SL properly. Fixed. Trade will no longer exit on opposite candle pattern.
Release Notes
Updated with leverage parameters for back testing. It no longer estimates P/L for trading SPY options.
Added alerts for all 3 Candle Strike signals, can be accessed by selecting "alert() function calls" when adding Alerts
Added options to display moving average lines.
Added take profit options (price target hit / trailing after price target hit)
Added session control for entries. Strategy will close all trades outside of trade entry session
* note that this strategy is no longer optimized for trading SPY 1 min timeframe. It can be used in all markets and assets.
1minATRCandlestick analysiscandlestickpatternMoving AveragesscalpingSPDR S&P 500 ETF (SPY) Trend Analysis

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


If you make $$$ off it, consider donating some of your juicy gain :)
Buy me a coffee - buymeacoffee.com/PtGambler
PayPal - paypal.me/PtGambler

You can reach me privately through my Discord Channel: discord.gg/WMQfaVGyQC
Also on:

Disclaimer