Phase Oscillator Momentum Strategy by DefinedEdge

By DefinedEdge

Performance Metrics

Description

๐Ÿ“Œ OVERVIEWI wanted a clean way to test what happens when NQ gets really stretched on the Saty Phase Oscillator, so I turned its ยฑ100 readings into a rules based strategy. It enters on the thrust during the morning session and is flat by the close. Everything else in here is a switch you can flip and test yourself.๐Ÿ™ CREDITThe oscillator is Saty Mahajan's work, and he publishes it on TradingView as the Saty Phase Oscillator. I rebuilt it from his formula to use as the entry trigger, so all credit for the oscillator itself goes to him. What this script adds is the strategy around it.๐Ÿ“ HOW THE OSCILLATOR WORKSIt measures how far price has stretched from its 21 period EMA, scaled by volatility:- Distance = close minus the 21 period EMA- Raw value = distance รท (3 ร— ATR 14) ร— 100- Oscillator = 3 period EMA of the raw valueSo +100 means price is three ATRs above the 21 EMA, and -100 means three ATRs below. You'll see it in its own pane with reference lines at ยฑ100, ยฑ61.8 and zero. Before you trust any signal, drop Saty's original indicator on the same chart and make sure the two lines match.โš™๏ธ DEFAULT RULES1. NQ futures, 10 minute chart, full Globex session.2. Long when the oscillator crosses above +100, short when it crosses below -100.3. New entries only between 09:30 and 11:00 New York time.4. A long exits when the oscillator crosses below -100 and a short exits when it crosses above +100. If that happens inside the entry window, the position flips.5. Anything still open gets closed at 16:00 New York time, so nothing is held overnight. There's also a safety check that closes any position it finds outside the session, which covers early close days.6. One contract per trade. No stop loss, no profit target.๐Ÿงฐ WHAT THE SCRIPT ADDSAll of this is off by default. None of it has been validated out of sample, so test it before you trust it.- Signal level. Trade the ยฑ100 extreme (the default), the ยฑ61.8 level, or the zero line. The lower you go, the more often it trades and the less stretched price is when it enters.- Full session entries, which let trades start anywhere between 09:30 and 16:00 instead of just the morning window.- An overnight hold that skips the 16:00 close and waits for the exit signal instead. Expect gap risk and bigger drawdowns if you turn this on.- Three exit rules to choose from: the opposite level cross (default), a return to zero, or leaving the entry zone.- A VWAP filter that skips entries when price is already more than a set number of ATRs away from session VWAP.- A hard stop and a trailing stop, both set as a percent of the entry price. The trail only kicks in once the trade is up by the trail distance, then follows the best price by that same amount.- From and To dates, so you can tune on one stretch of history and check the result on a stretch you never touched.๐Ÿš€ HOW TO USE ITPut it on an NQ 10 minute chart and check the oscillator lines up with the original. Set commission and slippage to whatever your broker actually charges. If you change any of the optional settings, run them through the date window on data you didn't tune on before relying on them.๐Ÿ“Š STRATEGY PROPERTIES USED FOR THE REPORT- Initial capital: 100,000 USD, a realistic account size for holding one NQ contract- Order size: 1 contract- Commission: 2.10 USD per contract per side- Slippage: 1 tick per fill (0.25 points, or 5 USD on NQ)- Margin: 10% for longs and shorts, a conservative estimate of exchange margin for one NQ contract- Fills happen at the open of the bar after the signal. There's no lookahead, no higher timeframe data and no bar magnifier.With these defaults, NQ 10 minute history gives well over 100 trades.โš ๏ธ LIMITATIONS- The ยฑ100 threshold is tuned for NQ on the 10 minute chart. On another symbol or timeframe the same reading means a different sized move, so test it again before using it there.- Your results will depend on how much history your plan loads, how the continuous contract rolls, and your real costs.- Stops are simulated on bar data, so live fills can be different.- A backtest doesn't tell you what happens next. This script is for research and education only. It isn't financial advice.

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView