Directional/Momentum Based Strategies

- KEY TAKEAWAYS - Momentum Strategies/Trending strategies is designed to take advantage of uptrends, where the price tends to make new highs, or downtrends, where the price tends to make new lows. - An uptrend is a series of higher swing highs and higher swing lows. A downtrend is a series of lower swing highs and lower swing lows. - In addition to looking at swing highs and lows, trend traders utilize other tools such as trendlines, moving averages, and technical indicators to help identify the trend direction and potentially provide trade signals.

Momentum Strategies are generally derived from Technical Analysis of any security such as Share,Index,ETF and F&O contracts based on price action.
Technical Analysis is purely based on Theories driven by prominent Statistican's, Mathematician's which include mathematically driven formula's result's in formation of indicators.
List and Type of Indicators.There are 100+ indicators and still counting but some are widely used.
Technical Analysis is bit vast subject but Varsity's Technical Analysis chapter cover's most important topics.TA is synonymous with DA(Data Analysis).
In TA Data is in terms of price(numbers), while in DA data could be in numeric as well as non-numeric form.

On Lighter Note,during my initial day's I do tried to create custom TA indicator(R&D) and thought of giving my name to it.Though no progress is done 🤦‍♂️.

Below is/are some Momentum Strategies I am building/implementing during Market Hours.

1. ATR Based Stoploss Trailing in ETF's (Exchange Traded Funds)-

ATR Trailing Stop Loss strategy basic functionality/working is stated here. Configuration of ATR indicator is default which is set as 3 x 21-Day ATR in my trading terminal.

Initiating/Implementing strategy on Major NSE indices such as Nifty 50,Nifty Bank and Nifty IT and buying ETF's of that particular index such as NIFTYBEES,BANKBEES and ITBEES based on my Entry Points. List of other indices.

Entry/Initiating Strategy-

- Buying ETF(from exchange), when MRR indicating -1% or below, indicate that the particular is near it's bottom and price's will likely to move upward sooner or later. - Same can be seen in Viz. I have backtested on more than 15+ year's of data before GA with it.Though I am sharing VIZ of last 1 year of BackTested Data. Still the Trend is same of 15+ years of data and Market's (Indices) tend to move in Cycles.

Below Viz Shows Mean Reversion Return(MRR) of 3 indices. When the MRR falls below -1% then it generate buy Signal.Initiate/Enter Strategy after generating buy signal.

Do Click on Individual Legends on top left corner in Viz to see individual MRR for indices.

- Rationale behind selecting only 3 specific indices. 1. ETF of these 3 indices are highly liquid(easy to transact on exchange/secondary market), result in lower slippage while making transaction, otherwise illiquid ETF's can reduce profits. 2. India's Top Companies are present in these 3 indices such as INFY,TCS,HDFC etc which make it reliable to execute and does not depend on single company result in we are seeing cyclic returns in Mean Reversion mostly moving between -1% to 1%. While if Strategy implemented on Single listed company on exchange, the risk increased exponentially so it will be tracking single company instead list of group of companies present in Index. Off Topic Thought's- "ETF's are considered are Great investment instrument's,It provide cushion again volatality and help's in generating returns which beat's inflation." Giving Above Statement strictly based on Past Performace(Historical Data),"No Guarantee" can be given for the same in Future in this uncertain world.

Exit Strategy-

- Selling ETF(on exchange), when MRR indicating +1% or above, indicate that the particular is near it's top and price's will likely to move downward sooner or later (for shorter or longer period of time, based on realtime movement of price of indices). - Same can be seen in Viz. I have backtested on more than 15+ year's of data before GA with it.Though I am sharing VIZ of last 1 year of BackTested Data. Still the Trend is same of 15+ years of data and Market's (Indices) tend to move in Cycles.

Once Strategy is Initiated/Entered,a trailing stop loss can be set on indices using ATR Trailing Stop Loss indicator in the trading terminal directly.

- Entry and Exit's are equally important which will determine the P&L. - Exit based on MRR and ATR based Trailing Stop Loss indicator will be different.Will take some time the determine merit's and demerits of both exit strategies. - This Strategy is implemented strictly implemented in Cash Markets (on exchange).If transacting in ETF's,it cannot be implemented in Future and Option Market/Segmet(F&O). - This Strategy cannot be implemeted on Intraday Basis, It's Cash and Carry(CNC) based strategy. Also Short Tradeing is not permitted by exchanges(Heavy penalities/fines are applicable) on ETF's which comes under cash segment. - Strategy should initiate with buying only, if intiated strategy with selling ETF's will be called Short Tradeing, it will cause penalities/fines from Exchanges. - Strategy should exit with selling same quantity of ETF which are bought during Entering/Buying Strategy. Ex- I brought NIFTYBEES(ETF) at ₹ 167/piece having quantity-500 shares, of value=167*500= ₹ 83500 on 17-Jun-2022, when MRR of Nifty-50 is at -1%. After 10 day's on 22-Jul-2022, MRR moves close to +1%, and price of NIFTYBEES ETF was ₹ 182/piece and sold to that price of quantity-500 shares. So Net P&L will be =(Selling value-Buying Value)*quantity = (182-167)*500 = ₹ +7500 Profit. Can Verify MRR Returs from above VIZ. **Like Above Example, Buying and Selling timeframes will depend on buying and exit strategies.(No assumptions are being made) - Timeframe to stay put in strategy solely based on decision of executing person, though a set of parameters when to exit are discussed above. - From Developer and Scalability POV, this strategy is highly agile,easy,efficient to code,automate,viz/dashboard creation and alert monitoring buying and selling signal generation based on MRR parameters as well as ATR Based Trailing Stop loss. **From my side,this strategy currently implemented in dev env and automation(ETL pipeline/Database/VIZ/Dashboard/Alerting Module) is completed.

2. ATR Based Trailing Stoploss

i) ATR Based Trailing SL in USD/INR FUT:

ATR-TS (Avg True Range Trailing Stoploss)on Daily timeframe with Configuration of periods=7 and muliplier=3.

ii) ATR Based Trailing SL in NIFTY FUT:

ATR-TS (Avg True Range Trailing Stoploss) with Configuration of periods=14 and muliplier=3

BACKTESTING ATR Based Trail. SL in NF FUT:

Backtesting is one of the most important aspects of developing a trading system. If created and interpreted properly, it can help traders optimize and improve their strategies, find any technical or theoretical flaws, as well as gain confidence in their strategy before applying it to the real world markets.

- Below Backtest result are done on ATR Configuration of periods=21 and muliplier=3. - Backtest Result are performed on interval of 1D. We can select shorter interval such as 1 min,3 min,5min,15 min,30 min, 1h, 2h, 3h. - Backtesting result showing P&L based calculation on 1 lot, based of change in number of lots, P&L will in multiple of lots, as Backtesting is performed on Futures. - Backtesting is performed on last 7 years of data, Max period can be 20 years. ** Python Script functionality ** - Python Script performing End to End backtesting from Data Extraction,Manipulation,Calculations,Storing Data to Database(ETL Pipeline) for multiple ATR Configuration, interval, period, symbols(current results showing on for 1 symbol which is NF),comparing all stated parameters & generate best possible trading signals(alerts) to end user with high winning probablity trade, end user has nothing to do ,but only act on Trading Signal generated through Algorithm. Below are the Basic Sample Backtesting Results are for standalone configuration,interval,period,symbol. In Future, Backtesting Module will be implemented seperately,currently backtesting is done for only above strategy. My 2 Cents: Backtesting gives an fair idea, how certain strategies worked out in past, what can be the max drawdownes,Prob of Profit & Loss,Winning/Lossing Streaks, P&L ratio are the decisive factor which decides whether to Trade Strategy or not based on results, also user have fair idea Max P&L as well. During Panic/Sell offs above factors plays pivotal role in not only reducing lossed but also builds conviction rather than depending on random gut feeling to make decisions. Not All Strategies worked in All Kind of Markets, Momemtum Strategies worked in Trending Markets & Non Directional Strategies(Delta Neutral options Strat.)

Backtest Result forLong Trade:

- Total Profit/Loss from long strategy for NF FUT in ₹ per lot 653400.0 - Max Loss in Long Position in Supertrend Strategy for NF FUT per lot in ₹ -30450.0 - Max Profit in Long Position in Supertrend Strategy for NF FUT per lot in ₹ 137450.0 - Total Trades: 22 - Number of Trades in Profit in Long Trade: 15 - Number of Trades in Loss in Long Trade: 7 - Count of Trade percentage in loss for NF FUT in percent (POL) 32 % - Count of Trade percentage in Profit for NF FUT in percent (POP) 68 % - P&L Ratio for Long Trade Strategy: 2.14 - Avg Profit in Long Trade in ₹: 49153 - Avg Loss in Long Trade in ₹: -11986

Backtest Result for Short Trade:

- Total Profit/Loss from short strategy for NF FUT in ₹ per lot 90945.0 - Max Loss in short Position in Supertrend Strategy for NF FUT per lot in ₹: -34017.0 - Max Profit in short Position in Supertrend Strategy for NF FUT per lot in ₹: 134300.0 - Number of Trades in Loss in Short Trade: 13 - Number of Trades in Profit in Short Trade: 8 - Total Trades in Short Trade Strategy: 21 - Count of Trade percentage in Loss for NF FUT in percent (POL) 62 % - Count of Trade percentage in Profit for NF FUT in percent (POP) 38 % - P&L Ratio for Short Trade Strategy: 2.14 - Avg Profit in Short Trade is ₹: 39692 - Avg Loss in Short Trade is ₹: -17430

Combined Long and Short Trades:

SymbolEntry_dateEntryVix at EntryExit_dateExitVix at ExitPositionDifferenceP&L in Rs.Days_in_trade
NF FUT2016-02-24 7019.024.02016-09-29 8591.015.0Long Trade1573.078650.0218.0
NF FUT2016-09-29 8591.015.02017-01-05 8274.015.0Short Trade317.015873.098.0
NF FUT2017-01-05 8274.015.02017-08-10 9820.012.0Long Trade1546.077300.0217.0
NF FUT2017-08-10 9820.012.02017-09-01 9974.014.0Short Trade-154.0-7708.022.0
NF FUT2017-09-01 9974.014.02017-09-25 9873.011.0Long Trade-102.0-5100.024.0
NF FUT2017-09-25 9873.011.02017-10-10 10017.013.0Short Trade-144.0-7218.015.0
NF FUT2017-10-10 10017.013.02017-11-14 10187.012.0Long Trade170.08500.035.0
NF FUT2017-11-14 10187.012.02017-11-27 10400.013.0Short Trade-213.0-10648.013.0
NF FUT2017-11-27 10400.013.02017-12-01 10122.014.0Long Trade-278.0-13900.04.0
NF FUT2017-12-01 10122.014.02017-12-15 10333.015.0Short Trade-211.0-10573.014.0
NF FUT2017-12-15 10333.015.02018-02-02 10761.014.0Long Trade427.021350.049.0
NF FUT2018-02-02 10761.014.02018-04-09 10379.016.0Short Trade381.019062.066.0
NF FUT2018-04-09 10379.016.02018-05-21 10517.014.0Long Trade137.06850.042.0
NF FUT2018-05-21 10517.014.02018-06-07 10768.013.0Short Trade-252.0-12582.017.0
NF FUT2018-06-07 10768.013.02018-09-05 11477.013.0Long Trade709.035450.090.0
NF FUT2018-09-05 11477.013.02018-11-07 10598.019.0Short Trade879.043927.063.0
NF FUT2018-11-07 10598.019.02019-02-18 10641.018.0Long Trade43.02150.0103.0
NF FUT2019-02-18 10641.018.02019-03-06 11053.016.0Short Trade-412.0-20602.016.0
NF FUT2019-03-06 11053.016.02019-05-08 11359.021.0Long Trade306.015300.063.0
NF FUT2019-05-08 11359.021.02019-05-20 11828.023.0Short Trade-469.0-23440.012.0
NF FUT2019-05-20 11828.023.02019-07-08 11559.014.0Long Trade-270.0-13500.049.0
NF FUT2019-07-08 11559.014.02019-09-20 11274.016.0Short Trade284.014220.074.0
NF FUT2019-09-20 11274.016.02020-01-31 11962.015.0Long Trade688.034400.0133.0
NF FUT2020-01-31 11962.015.02020-02-05 12089.014.0Short Trade-127.0-6353.05.0
NF FUT2020-02-05 12089.014.02020-02-25 11798.016.0Long Trade-291.0-14550.020.0
NF FUT2020-02-25 11798.016.02020-04-09 9112.031.0Short Trade2686.0134300.044.0
NF FUT2020-04-09 9112.031.02020-09-22 11154.019.0Long Trade2042.0102100.0166.0
NF FUT2020-09-22 11154.019.02020-10-01 11417.021.0Short Trade-263.0-13165.09.0
NF FUT2020-10-01 11417.021.02021-01-27 13968.020.0Long Trade2551.0127550.0118.0
NF FUT2021-01-27 13968.020.02021-02-02 14648.021.0Short Trade-680.0-34017.06.0
NF FUT2021-02-02 14648.021.02021-02-26 14529.023.0Long Trade-119.0-5950.024.0
NF FUT2021-02-26 14529.023.02021-05-18 15108.020.0Short Trade-579.0-28947.081.0
NF FUT2021-05-18 15108.020.02021-10-28 17857.016.0Long Trade2749.0137450.0163.0
NF FUT2021-10-28 17857.016.02022-01-03 17626.021.0Short Trade232.011578.067.0
NF FUT2022-01-03 17626.021.02022-01-21 17617.016.0Long Trade-9.0-450.018.0
NF FUT2022-01-21 17617.016.02022-03-14 16871.019.0Short Trade746.037292.052.0
NF FUT2022-03-14 16871.019.02022-04-19 16959.027.0Long Trade87.04350.036.0
NF FUT2022-04-19 16959.027.02022-07-07 16133.020.0Short Trade826.041288.079.0
NF FUT2022-07-07 16133.020.02022-08-29 17313.017.0Long Trade1180.059000.053.0
NF FUT2022-08-29 17313.017.02022-09-12 17936.017.0Short Trade-623.0-31172.014.0
NF FUT2022-09-12 17936.017.02022-09-23 17327.018.0Long Trade-609.0-30450.011.0
NF FUT2022-09-23 17327.018.02022-10-24 17731.017.0Short Trade-403.0-20170.031.0
NF FUT2022-10-24 17731.017.02022-12-16 18269.016.0Long Trade538.026900.053.0
NF FUT2022-12-16 18269.016.0OngoingOngoingOngoingShort TradeOngoingOngoingOngoing

Combined Backtesting Paramaeters for ATR TS Strategy on NF FUT:

- Overall Winning Streak 4 - Overall Losing Streak : 3 - Max Profit Overall in Supertrend Strategy for ^NSEI per lot in ₹ 137450.0 - Max Loss Overall in Supertrend Strategy for ^NSEI per lot in ₹ -34017.0 - Total Overall P&L in Supertrend Strategy for ^NSEI per lot in ₹ 744345.0 - Overall Losing Streak Loss in Supertrend Strategy for ^NSEI FUT per lot in ₹ -20026.0 - Overall Winning Streak Profit in Supertrend Strategy for ^NSEI FUT per lot in ₹ 141930.0 - Total Trades: 43 - Count of Trades having Loss: 20 - Count of Trades having Profit: 23 - SuperTrend Strategy P&L ratio 1.15 - Count of Trade percentage in Loss for ^NSEI in percent (POL) 47 % - Count of Trade percentage in Profit for ^NSEI in percent (POP) 53 %

If any queries do raise PR on this repo for any correction / clarification.Will be happy to help/solve queries.
*This Information is just for knowledge purpose,never consider it as investment advice,"No Guaranteed" profit's can be assured in any strategy.

Glossary