F3a_AO

This script is a technical analysis tool designed to identify potential buying and selling opportunities by synthesizing data from multiple external indicators. It functions as a signaling system that monitors price momentum, trend strength, and moving average filters to provide visual cues (arrows) and real-time notifications on a trading chart.

Core Logic Overview

The script operates by pulling data from two specific secondary components: NavelEMA and TrendForce_3. It processes this information through a multi-layered logic sequence to determine market direction:

  • Momentum Analysis: The script calculates the difference between two distinct moving averages (Fast and Slow) provided by the NavelEMA component. By comparing these values, it identifies the "speed" and "direction" of the current price movement.
  • Trend Strength Verification: It simultaneously references the TrendForce_3 indicator to measure the underlying power of the market. This acts as a secondary filter to ensure that signals are not generated during low-volatility periods where the trend is weak.

Signal Generation Rules

The script looks for specific "turning points" in the data. To trigger a signal, it evaluates three conditions simultaneously:

  1. Directional Shift: It checks if the momentum buffer is moving in a specific direction (increasing for buys, decreasing for sells).
  2. Moving Average Confirmation: It verifies that the filtered moving average is trending in alignment with the desired direction.
  3. Trend Thresholds:
    • For Buy Signals: If the trend force exceeds a specific positive threshold (indicating strong upward pressure), it prioritizes one type of visual signal; if the pressure is lower, it triggers a secondary confirmation.
    • For Sell Signals: If the trend force drops below a specific negative threshold (indicating strong downward pressure), it prioritizes one type of visual signal; otherwise, it provides a secondary confirmation.

User Interface and Notifications

The script translates these complex calculations into three user-friendly features:

  • Visual Indicators: It places distinct arrows on the chart at the high or low prices of candles where the buy/sell logic is satisfied. The "Primary" vs. "Secondary" signal distinction allows traders to see not just that a move is happening, but how strong that move is based on the trend force.
  • On-Screen Comments: It can automatically display text comments in the corner of the chart, providing the current trade recommendation (Buy/Sell) and the current price.
  • Real-Time Alerts: When a signal is confirmed in real-time, the script can trigger an audible alert and a pop-up message containing the symbol name, the timeframe, and the current market price, allowing traders to react instantly without staring at the screen constantly.
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
9 Views
0 Downloads
0 Favorites
F3a_AO
//+------------------------------------------------------------------+
//|                                                       F3a_AO.mq4 |
//+------------------------------------------------------------------+
#property  copyright "Copyright © 2004, MetaQuotes Software Corp."
#property  link      "http://www.metaquotes.net/"
#property  link      "Alert by GOEN"

//+------------+-----------------------------------------------------+
//  Bookkeeper: Ïîäïðàâèë íåìíîãî ïî ñâîåìó
//  Íåîáõîäèìî íàëè÷èå NavelEMA.mq4
//  Presence NavelEMA.mq4 is necessary 
//  Íåîáõîäèìî íàëè÷èå TrendForce_3.mq4
//  Presence TrendForce_3.mq4 is necessary 
//+------------------------------------------------------------------+
#property  indicator_chart_window
#property  indicator_buffers 4
#property  indicator_color1  Green
#property  indicator_color2  Red
#property  indicator_color3  Green
#property  indicator_color4  Red
extern int  MaxBars=500;
extern int  MA_Filtr=3;
extern int  MA_Fast=13;
extern int  MA_Slow=144;
extern bool WithAlert=false;
extern bool WithComment=true;
double up_buffer[];
double dn_buffer[];
double up1_buffer[];
double dn1_buffer[];
double ind_buffer[];
datetime lastalert=0, lastcomment=0;
//+------------------------------------------------------------------+
int deinit()
  {
   Comment("");
  }
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(5);
   SetIndexStyle(0,DRAW_ARROW);//
   SetIndexStyle(1,DRAW_ARROW);//
   SetIndexArrow(0,233); 
   SetIndexArrow(1,234); 
   SetIndexEmptyValue(0,0.0);
   SetIndexEmptyValue(1,0.0);
   SetIndexStyle(2,DRAW_ARROW,EMPTY,1);//
   SetIndexStyle(3,DRAW_ARROW,EMPTY,1);//
   SetIndexArrow(2,233); 
   SetIndexArrow(3,234); 
   SetIndexEmptyValue(2,0.0);
   SetIndexEmptyValue(3,0.0);
   SetIndexDrawBegin(0,MA_Slow+2);
   SetIndexDrawBegin(1,MA_Slow+2);
   SetIndexDrawBegin(2,MA_Slow+2);
   SetIndexDrawBegin(3,MA_Slow+2);
   if(!SetIndexBuffer(0,up_buffer) &&
      !SetIndexBuffer(1,dn_buffer) &&
      !SetIndexBuffer(2,up1_buffer) &&
      !SetIndexBuffer(3,dn1_buffer) &&
      !SetIndexBuffer(4,ind_buffer))
      Print("cannot set indicator buffers!");
   return(0);
  }
//+------------------------------------------------------------------+
//| Awesome Oscillator                                               |
//+------------------------------------------------------------------+
int start()
  {
   int    limit;
   int    counted_bars=IndicatorCounted();
   double prev, current;
   double upforce, downforce;
   static datetime lastalert;
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   if(limit>MaxBars) limit=MaxBars;
   for(int i=0; i<limit; i++)
      ind_buffer[i]=iCustom(NULL,0,"NavelEMA",MA_Fast,0,0,i)-
                    iCustom(NULL,0,"NavelEMA",MA_Slow,0,0,i);
   for(i=limit; i>=0; i--)
     {
      current=iCustom(NULL,0,"NavelEMA",MA_Filtr,0,0,i);
      prev=iCustom(NULL,0,"NavelEMA",MA_Filtr,0,0,i+1);
      upforce=iCustom(NULL,0,"TrendForce_3",MaxBars,false,0,i);
      downforce=iCustom(NULL,0,"TrendForce_3",MaxBars,false,1,i);
      if(ind_buffer[i]>ind_buffer[i+1] && current>=prev &&
         ind_buffer[i+1]<=ind_buffer[i+2])
      {
         if(upforce>25)
         {
            up_buffer[i]=0;
            up1_buffer[i]=Low[i]-Point*10;
         }
         else
         {
            up1_buffer[i]=0;
            up_buffer[i]=Low[i]-Point*10;
         }
      }
      else { up_buffer[i]=0.0; up1_buffer[i]=0.0; }
      if(ind_buffer[i]<ind_buffer[i+1] && current<=prev &&
         ind_buffer[i+1]>=ind_buffer[i+2])
         if(downforce<-25)
         {
            dn_buffer[i]=0;
            dn1_buffer[i]=High[i]+Point*10;
         }
         else
         {
            dn1_buffer[i]=0;
            dn_buffer[i]=High[i]+Point*10;
         }
      else { dn_buffer[i]=0.0; dn1_buffer[i]=0.0; }
     }
   if(WithAlert==true && lastalert!=Time[0])
   { 
      if (up_buffer[0]>Point || up1_buffer[0]>Point)
      {  
         Alert("Buy " +Symbol()+"_"+Period()+" "+
               " "+DoubleToStr(MarketInfo(Symbol(),MODE_ASK),Digits)+
               " "+TimeToStr(TimeCurrent(),TIME_MINUTES));
         lastalert=Time[0];
      }
      if (dn_buffer[0]>Point || dn1_buffer[0]>Point)
      {  
         Alert("Sell " +Symbol()+"_"+Period()+
               " "+DoubleToStr(MarketInfo(Symbol(),MODE_BID),Digits)+
               " "+TimeToStr(TimeCurrent(),TIME_MINUTES));
         lastalert=Time[0];
      }
   }
   if(WithComment==true && lastcomment!=Time[0])
   { 
      if (up_buffer[0]>Point || up1_buffer[0]>Point)
      {  
         lastcomment=Time[0];
         Comment("Buy ",Symbol(),"_",Period()," ",
               " "+DoubleToStr(Close[0],Digits));
      }
      if (dn_buffer[0]>Point || dn1_buffer[0]>Point)
      {  
         lastcomment=Time[0];
         Comment("Sell ",Symbol(),"_",Period(),
               " "+DoubleToStr(Close[0],Digits));
      }
   }
   return(0);
  }
//+------------------------------------------------------------------+

Comments