This indicator provides dynamic bar coloring and buy/sell signals based on EMA relationships and price momentum. It allows traders to visually identify trend changes and potential trade opportunities directly on the chart.
Indicator Basics:
Name: The script is titled "JCM_Madrid". Overlay: It overlays its calculations and outputs directly on the price chart.
User Inputs: -Range: Defines the length of the EMA (Exponential Moving Average). -Ref-1 and Ref-2: Set reference lengths for secondary EMAs used in the calculations. -Source: The price data source for EMA calculations (e.g., close, open, high, low). -Enable Buy/Sell: Boolean toggles to activate or deactivate buy and sell signals.
Calculations: EMA Value: Computes the main EMA based on the source and Range. CloseMA: The difference between the close price and the EMA. SqzMA: The difference between a secondary EMA (Ref-1) and the main EMA. RefMA: The difference between another secondary EMA (Ref-2) and the main EMA. Bar Coloring:
Bars are colored based on the relationship between SqzMA and CloseMA: Purple: When SqzMA > CloseMA. Blue: When SqzMA < CloseMA. Buy/Sell Signals:
A Buy Signal is generated when: CloseMA crosses from below to above 0. The close price is higher than the previous close. Buy signals are enabled. A Sell Signal is generated when: CloseMA crosses from above to below 0. The close price is lower than the previous close. Sell signals are enabled. Signals are displayed as labels on the chart: "Buy": Green label below the candle. "Sell": Yellow label below the candle