OPEN-SOURCE SCRIPT
Deviation from Mid MA5 & MA10 (%)

Title:
Deviation from Mid-Price MA5 & MA10 (%)
Description:
This script calculates and displays the percentage deviation of the current mid-price from its 5-day and 10-day simple moving averages.
The mid-price is defined as the average of the open and close prices: (Open + Close) / 2
Instead of relying on traditional close-based MAs, this version uses mid-price to better reflect actual price flow by incorporating both the opening and closing values.
Main features:
Displays % deviation from both 5-day and 10-day mid-price moving averages
Better alignment with intraday reality due to gap-sensitive mid-price base
Smooths out erratic closing spikes for clearer signals
Helps identify overextended moves and potential pullback zones
Included lines:
Deviation from 5-day Mid MA
Deviation from 10-day Mid MA
Zero baseline for reference
Recommended for:
Traders seeking a cleaner measure of price deviation
Short-term pullback or re-entry strategy users
Anyone analyzing steady, low-volatility uptrends
Deviation from Mid-Price MA5 & MA10 (%)
Description:
This script calculates and displays the percentage deviation of the current mid-price from its 5-day and 10-day simple moving averages.
The mid-price is defined as the average of the open and close prices: (Open + Close) / 2
Instead of relying on traditional close-based MAs, this version uses mid-price to better reflect actual price flow by incorporating both the opening and closing values.
Main features:
Displays % deviation from both 5-day and 10-day mid-price moving averages
Better alignment with intraday reality due to gap-sensitive mid-price base
Smooths out erratic closing spikes for clearer signals
Helps identify overextended moves and potential pullback zones
Included lines:
Deviation from 5-day Mid MA
Deviation from 10-day Mid MA
Zero baseline for reference
Recommended for:
Traders seeking a cleaner measure of price deviation
Short-term pullback or re-entry strategy users
Anyone analyzing steady, low-volatility uptrends
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.