wma_cross_3ema

Download script
Author: Kalenzo
wma_cross_3ema

This technical tool is designed to assist traders by identifying specific momentum shifts in the financial markets. It functions as a visual signaling system that monitors price movements and translates them into clear "Buy" and "Sell" markers directly on your trading chart.

How the Logic Works

The core of this script relies on analyzing three different moving averages simultaneously. These averages act as filters to help distinguish between minor market "noise" and significant trend changes. By comparing a fast-moving average against two slower, larger averages (medium and big), the script looks for a specific moment of "crossover."

Buy and Sell Signals

The tool generates signals based on the following behavior:

  • Buy Signals: The script identifies a potential upward move when the fastest moving average moves from below to above both the medium and large moving averages at the same time. When this happens, an upward-pointing arrow appears on the chart.
  • Sell Signals: Conversely, it identifies a potential downward move when the fastest moving average drops from above to below both the medium and large moving averages simultaneously. In this case, a downward-pointing arrow is placed on the chart.

Key Features and Notifications

Beyond just drawing arrows on your screen, the script includes several customizable features to keep you informed of market activity:

  • Real-Time Alerts: You can enable pop-up alerts that notify you instantly when a new signal is detected, ensuring you don't have to stare at the screen constantly.
  • Audio Notifications: The script can be configured to play a specific sound file (such as an alert beep) whenever a signal occurs.
  • Visual Markers: Signals are plotted clearly above or below the price candles, making it easy to see exactly where the tool detects a shift in market momentum.

In summary, this tool simplifies technical analysis by automatically calculating complex moving average relationships and highlighting the exact moments when the short-term trend breaks away from the broader market averages.

Price Data Components
Series array that contains the lowest prices of each barSeries array that contains open time of each barSeries array that contains the highest prices of each bar
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1It plays sound alerts
12 Views
0 Downloads
0 Favorites
wma_cross_3ema
//+------------------------------------------------------------------+
//|                                                                  |
//|                                                          Kalenzo |
//|                                                  simone@konto.pl |
//|                                    Modified by Newdigital        |
//+------------------------------------------------------------------+

#property copyright "Kalenzo"
#property link      "simone@konto.pl"

#property indicator_chart_window
#property indicator_color1 Aqua
#property indicator_color2 Magenta


extern bool UseAlert = True;
extern string NameFileSound = "alert.wav";
extern double ShortPeriod = 5;
extern int ShortPeriodMode =  1; //0=sma, 1=ema, 2=smma, 3=lwma
extern double BigPeriod = 12;
extern int BigPeriodMode =  1; //0=sma, 1=ema, 2=smma, 3=lwma
extern int MediumPeriod = 9;
extern int MediumPeriodMode =  0; //0=sma, 1=ema, 2=smma, 3=lwma
extern bool UseSound = False;
bool TypeChart = False;
//int DeltaForSell = 7;
//int DeltaForBuy = 7;

#property indicator_buffers 2
//---- input parameters
//---- buffers
double UpBuffer[];
double DnBuffer[];
double alertBar;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators

  // IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW,EMPTY,1);
   SetIndexStyle(1,DRAW_ARROW,EMPTY,1);
  
   SetIndexBuffer(0,UpBuffer);
   SetIndexBuffer(1,DnBuffer);
  
   SetIndexArrow(0,233);
   SetIndexArrow(1,234);

   SetIndexLabel(0,"Up Signal");
   SetIndexLabel(1,"Down Signal");

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
  
   int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) counted_bars=0;
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   
  
   for(int i = 0 ;i < limit ;i++)
   { 
      double pwma5 = iMA(Symbol(),0,ShortPeriod,0,ShortPeriodMode,PRICE_CLOSE,i+1);
      double cwma5 = iMA(Symbol(),0,ShortPeriod,0,ShortPeriodMode,PRICE_CLOSE,i);
      
      double pwma50 = iMA(Symbol(),0,BigPeriod,0,BigPeriodMode,PRICE_CLOSE,i+1);
      double cwma50 = iMA(Symbol(),0,BigPeriod,0,BigPeriodMode,PRICE_CLOSE,i);
            
      double pwma20 = iMA(Symbol(),0,MediumPeriod,0,MediumPeriodMode,PRICE_CLOSE,i+1);
      double cwma20 = iMA(Symbol(),0,MediumPeriod,0,MediumPeriodMode,PRICE_CLOSE,i);
      
      if( pwma5 <= pwma50 && cwma5 > cwma50 && pwma5 <= pwma20 && cwma5 > cwma20 )
      
      {  
        UpBuffer[i] = iLow(Symbol(),0,i)-(3*Point);
        DnBuffer[i] = EMPTY_VALUE;
      if (UseSound==1) PlaySound(NameFileSound);
      if (UseAlert==1 && Bars>alertBar) {Alert(Symbol(), "Buy signal", Period());alertBar = Bars;}
      if (TypeChart==1) Comment ("Buy signal at Ask=",Ask,", Bid=",Bid,", Date=",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime())," Symbol=",Symbol()," Period=",Period());
      }
      
      else if( pwma5 >= pwma50 && cwma5 < cwma50 && pwma5 >= pwma20 && cwma5 < cwma20 )
      {
        UpBuffer[i] = EMPTY_VALUE;
        DnBuffer[i] = iHigh(Symbol(),0,i)+(3*Point);
      if (UseSound==1) PlaySound(NameFileSound);
      if (UseAlert==1 && Bars>alertBar) {Alert(Symbol(), "Sell signal", Period());alertBar = Bars;}
      if (TypeChart==1) Comment ("Sell signal at Ask=",Ask,", Bid=",Bid,", Date=",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime())," Symbol=",Symbol()," Period=",Period());
      }
      else
      {
        DnBuffer[i] = EMPTY_VALUE;
        UpBuffer[i] = EMPTY_VALUE;
      }
      
      
  
   }
//----

   return(0);
  }
//+------------------------------------------------------------------+



Comments