Custom Trading Scripts

Your Online Source For Stock Codes

CTS Daily Early Bull/Bear Flag Column


This column helps traders identify specific patterns on a trading chart called “Bull Flags” and “Bear Flags.” These patterns can suggest potential market trends.
1. Calculating Trends:
– The code calculates the average of the closing prices over a specific period. It compares this average to its value 5 bars ago to determine if the market is trending up or down.2. Detecting Early MACD Conditions:
– The code checks if the difference between two moving averages (MACD Histogram) is decreasing or increasing. It also checks if the previous closing price is lower than the one before that.3. Detecting MACD Conditions:
– It extends the early MACD conditions to also ensure that the current closing price is higher than the previous high, or lower than the previous low.

4. Flag Triggers:
– It combines the trend and MACD conditions to identify potential flag patterns: bullish, bearish, early bullish, and early bearish.

5. Labeling and Coloring:
– It adds labels to the column based on the identified patterns. If there’s a bullish flag pattern, it labels it as “Bull Flag,” and similarly for other patterns.
– Different colors are used to make these labels stand out on the chart.

6. Background Colors:
– Background colors are set based on the patterns. Green indicates a bullish flag, yellow for early bullish, red for bearish, and dark orange for early bearish. White is used when no flag is detected.

This column helps traders spot specific patterns that could indicate upcoming trends in the market. It labels these patterns as “Bull Flags” (suggesting a potential upward trend) or “Bear Flags” (indicating a possible downward trend). It uses colors to make these patterns noticeable in the column, helping traders make more informed decisions.

Please note that this script is for educational purposes and cannot be shared due to user agreement restrictions.