TradingView
ForexStoryteller
13 mai 2022 09:50

Multiple MAs + No Trend Zone + ATR Widget 

Australian Dollar/Swiss FrancFXCM

Description

This is my first Pine Script attempt. Nothing special, just an "all in one" for the most common things I use, and what I have found to be the most common in a lot of strategies.

Great for free and limited accounts as it combines 7 total indicators into one.

-- First 5 indicators are Independant Moving Averages:
-Each one can be set for length, as well as source and type (SMA, EMA, SMMA, WMA, VWMA) individually

-- Second type (6th) of indicator is one I find extremly useful for staying OUT of consolidation trading. It's called a "No Trend Zone" indicator I swipped from the Hoffman Startegy. Basically, its set for a small deviation (0.5) of a 35 EMA, which creates a "Band" around the 35 line. When you have this "Band" flat or with no discernable incline/decline, with price action OR some or multiple moving averages inside this banded zone, it typically indicates a zone of consolidation. This will help you identify when you may be in one of those zones, that way you don't get trapped "waiting for paint to dry" before the market starts to move again with your position, and keep you from entering should you be considering the market at that time.

The last indicator is my favorite, and one I will refine a little deeper soon.

-- The ATR widget finishes us out. This widget can be customized for colors, turned on or off, and automatically rounds the ATR (ATR period based on the chart timeframe) to a nice readable number for what you're trading. It has settings to show or not, the length, what rounding style to use (forex pip 0.0001, forex/stock/etf/indicies 0.01) where to show it on the pane, a Multiplier Factor (for stop loss calculations automatically) and the colors.

***NOTE ABOUT ATR WIDGET:

I am primarily a forex trader, so the defaults are for Forex 0.0001. If you see some odd numbers (like 55798 on a current chart), check the inputs tab on the settings, and change the "ATR Style" from "Forex 0.0001" to "Forex/Stock/ETF/Indicies 0.01", and you should arrive with the correct number.

Notes de version

Added multipliers for Stop loss and Take Profit Calculations for a quick ATR number to use for setting calculations into the widget, with options to turn on or off the SL & TP numbers.

Notes de version

Added fixes to the code so it would display properly on mobile
Added more customizations for layout and size to make it as flexible as possible for your pane layout

Notes de version

**** Major Overhaul/Update! ****

The Department of Redundancy Department was a little mad I was copying their proprietary style, so I had to fix that lol :)

*Refined & optimized the original code -- Eliminated multiple switch cases with a single function call.

*Reduced the code size with variables for long strings

*Added 7 more Moving averages

*Updated the ATR widget display to show the actual multiplier used and not just a number

*Added the "Hoffman Inventory Retracement" candle recognition with the script from @UCSGEARS

*Added "*All Candlestick Patterns*" source code to help with spotting candle patterns directly on the chart

*Renamed the "No Trend Zone" to "Trend/No-Trend Channel" - It is still used the same way as described above, but on occassion with a steady trend, price will tend to use this zone as a Channel and bounce around within it as it climbs or falls, like a "Dynamic" channel at times. Still the same with a Flat channel, this means the market is probably ranging.

*Rearranged the settings tab to be a little cleaner and more organized. Moved The "Trend/No-Trend Channel" to the bottom so it would be in the right order on the "Styles" tab.

- Set up with 8 moving averages on, the last 4 are off.
- Defaults with Engulfing, Hammer, & Inverted Hammer Candles "On"
- Hoffman Inventory Racement Candles "On" by default
- 8 initial Moving Averages set in the fashion of the Hoffman overlay, with 4 extra (IDK you could need more? But its there...) by default.

Any ideas for more to add, or improvements, drop a comment and I'll see what I can do ;) Hopefully this helps you reduce the number of "Indicators" listed by tradeview so you can use others on a light account.

Happy Trading/Scalping

Notes de version

Typos \_0_/ & Rename + Script credits
Commentaires
donniewins
nice
lozl87994
Thank for the indicator :D, are you able to add the alert for the Hoffman Inventory Retracement Bar when that candle it closed? similar like the candlestick patterns that you list
ForexStoryteller
@lozl87994, I can do that. I've already improved the ATR widget and have a few other things planned. I'll add that to the list 🤠
lozl87994
@xAverageJoex, are you gonna use alertcondition() or alert()? i just read about that just a moment alert() seem like it can use to make alert pop up like when we turn on or edit the regular alerts
ForexStoryteller
@lozl87994, I'm still venturing through the reference manual and piecing things together as I go, and have not made it that far yet. Work, and business have kept me rather busy lately but I will opt for flexibility wherever possible when I make some more progress on it :)
lozl87994
@xAverageJoex, thank for the reply :D
lozl87994
@xAverageJoex, found it i just need to add this one " alertcondition(rsl or rss , title = "L or S Signal") " , it gonna show the Hoffman Inventory Retracement Bar alert in the alert setting. i kinda want put the condition rsl above ma2 and ma2 above ma3 for long signal alert, rss below ma2 and ma2 below ma3 for short signal alert but it got error :'(.
Anyway with this in the mean time i do not need to wait for chart to show the bar signal :D
lozl87994
@lozl87994, new update i think i got this right
" Lsignal = rsl == 1 and close > ma2 and ma2 > ma3
Ssignal = rss == 1 and close < ma2 and ma2 < ma3
alertcondition(Lsignal or Ssignal, title = "L or S Signal") "
ForexStoryteller
@lozl87994, Good deal. I do intend to minimize the code a lot with the import function, and I'll try to use that in the code, along with another idea that could extend it for other things, further making the alert custom. Maybe even a section dedicated to an alert system 🤔
lozl87994
@xAverageJoex, i glad it could help :). I still need to add some thing in to that code. Base on strategy, the space channel between ma2 and ma3 will not have any other ma. D:
Plus