• Get $40 off VIP by signing up for a free account! Sign Up

Zip Moving Averages For ThinkOrSwim

Katsu

New member
VIP
Author states:
This strategy uses only two simple moving averages, specifically the 50 SMA and the 100 SMA.

Simple moving average : A simple moving average (SMA) calculates the average of a selected range of prices, usually closing prices, by the number of periods in that range.

Here's how it works:

Background color:

The chart background is colored green when the price is above the 100 SMA.
The chart background turns red when the price is below the 100 SMA.

The greenback ground suggest the bullish momentum and the red background suggests the bearish momentum.

We can use this long term trend to take the trades in alignment with the trend to increase our odds.

We will use the 50 SMA to identify the spots when a new trend is starting. When the price crosses above the 50 SMA while the background is green, the candle/bar color changes to white indicating a new trend beginning.

Conversely, when the price crosses below the 50 SMA while the background is red, the candle/bar color also changes to white indicating a new trend beginning.

The occurrence of white candles indicates the start of a potential new trend in alignment with the long term trend.

However, it's essential to remember that like any trading strategy, this one is not perfect. For more reliable results, it's advisable to combine it with a consideration of the overall price structure to minimize false entry signals.

Originality and usefulness

Even though it makes use of two moving averages, we don't use the moving average crossover. The moving average crossovers are either lagging or provide too many false signals. We have tried to address these issue with this strategy. While maintaining the long-term trend and ignoring false signals, it gives out signals early.

You can choose the moving average that best suits your needs by changing these moving averages to a different moving average . The 50 SMA and 100 SMA appeared to be giving the better signals in my experience.

I dont use any other indicators but i would like to check the price structure to make sure its moving along with the 50 SMA. Sometimes the choppy markets might give false signals.

Its okay to see multiple white candles as long as the price structure holds.

I have highlighted the white candles in the above chart. The color of the candle is always the same so the background decides whether its bearish or bullish cross
imnfGdA.png
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

I'm looking for an indicator called Zip entry strategy from Tradingview. I have the code. Can you please help me code to Thinkscript
https://www.tradingview.com/script/oZ7aggHR-ZIP-Entry-Strategy-Using-50-SMA-and-100-SMA/

Author states:
This strategy uses only two simple moving averages, specifically the 50 SMA and the 100 SMA.

Simple moving average : A simple moving average (SMA) calculates the average of a selected range of prices, usually closing prices, by the number of periods in that range.

Here's how it works:

Background color:

The chart background is colored green when the price is above the 100 SMA.
The chart background turns red when the price is below the 100 SMA.

The greenback ground suggest the bullish momentum and the red background suggests the bearish momentum.

We can use this long term trend to take the trades in alignment with the trend to increase our odds.

We will use the 50 SMA to identify the spots when a new trend is starting. When the price crosses above the 50 SMA while the background is green, the candle/bar color changes to white indicating a new trend beginning.

Conversely, when the price crosses below the 50 SMA while the background is red, the candle/bar color also changes to white indicating a new trend beginning.

The occurrence of white candles indicates the start of a potential new trend in alignment with the long term trend.

However, it's essential to remember that like any trading strategy, this one is not perfect. For more reliable results, it's advisable to combine it with a consideration of the overall price structure to minimize false entry signals.

Originality and usefulness

Even though it makes use of two moving averages, we don't use the moving average crossover. The moving average crossovers are either lagging or provide too many false signals. We have tried to address these issue with this strategy. While maintaining the long-term trend and ignoring false signals, it gives out signals early.

You can choose the moving average that best suits your needs by changing these moving averages to a different moving average . The 50 SMA and 100 SMA appeared to be giving the better signals in my experience.

I dont use any other indicators but i would like to check the price structure to make sure its moving along with the 50 SMA. Sometimes the choppy markets might give false signals.

Its okay to see multiple white candles as long as the price structure holds.

I have highlighted the white candles in the above chart. The color of the candle is always the same so the background decides whether its bearish or bullish cross
Open-source script
check the below:

CSS:
# Indicator for TOS - www.UseThinkScript.com
#//narenderreddie
#indicator("Zip", shorttitle="Zip", overlay=true)
# Converted by Sam4Cok@Samer800    - 07/2024

input show_ma1   = yes; # "MA №1", inline="MA #1")
input ma1_type   = AverageType.SIMPLE;
input ma1_source = close; #  , ""     , inline="MA #1")
input ma1_length = 50; #     , ""     , inline="MA #1", minval=1)
input show_ma2   = no; # "MA №2", inline="MA #2")
input ma2_type   = AverageType.SIMPLE; #("SMA"  , ""     , inline="MA #2
input ma2_source = close; #  , ""     , inline="MA #2")
input ma2_length = 100; #     , ""     , inline="MA #2", minval=1)

def na = Double.NaN;
def pos = Double.POSITIVE_INFINITY;
def neg = Double.NEGATIVE_INFINITY;

def ma1 = MovingAverage(ma1_type, ma1_source, ma1_length);
def ma2 = MovingAverage(ma2_type, ma2_source, ma2_length);

plot MovAvg1 = if show_ma1 then ma1 else na; #, color = ma1_color, title="MA №1")
plot MovAvg2 = if show_ma2 then ma2 else na; #, color = ma2_color, title="MA №2")
MovAvg1.SetDefaultColor(Color.MAGENTA);
MovAvg2.SetDefaultColor(Color.CYAN);

#// Define a condition for changing the background color
def aboveSMA = close > ma2;
def belowSMA = close < ma2;
def bullCond= (close Crosses Above ma1) and aboveSMA;
def bearCond= (close Crosses Below ma1) and belowSMA;
#// Set background color based on the condition
AddCloud(if aboveSMA then pos else neg, if aboveSMA then neg else pos, Color.DARK_GREEN, Color.DARK_RED);

#// Plot the candles with the custom colors

AssignPriceColor(if bullCond then Color.WHITE else
                 if bearCond then Color.WHITE else Color.CURRENT);

#-- END of CODE
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
294 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top