XO_ALERT_cci_cross_v2

Download script
Author: Kalenzo
XO_ALERT_cci_cross_v2

This script functions as an automated monitoring tool designed to identify specific trend signals by analyzing multiple timeframes simultaneously. Rather than looking at a single chart, the logic cross-references data across five different intervals (60, 30, 15, and 5 minutes) to ensure that a trading signal is consistent and synchronized before notifying the user.

Core Logic Overview

The script operates through a two-stage validation process:

1. Multi-Timeframe Synchronization (The "XO" Signal) The tool constantly scans the market for specific "green" or "red" signals across four different timeframes. For a signal to be considered valid, the following conditions must be met:

  • Uniformity: All four timeframes (60m, 30m, 15m, and 5m) must actively display a "green" signal (for long positions) or a "red" signal (for short positions).
  • Transition Detection: The script specifically looks for the exact moment these signals appear. It checks if the current bars show active signals while the previous bars did not. This prevents the tool from firing repeated alerts on a trend that is already established, focusing instead on the initiation of a move.

2. Momentum Confirmation (CCI Filter) Once the multi-timeframe synchronization is detected and a direction (Long or Short) is set, the script applies a second layer of validation using the Commodity Channel Index (CCI).

  • This acts as a "confirmation" step to ensure that the price momentum aligns with the trend.
  • For a Long position, the tool waits for the CCI to cross from a negative value into a positive value.
  • For a Short position, the tool waits for the CCI to cross from a positive value into a negative value.

Execution Summary

The script will only trigger an alert when both conditions are satisfied: first, the structural trend must align across all specified timeframes simultaneously, and second, the momentum indicator must confirm the direction of the move. This multi-layered approach is intended to filter out "noise" and ensure that alerts are only generated when there is a cohesive agreement between different market scales.

Indicators Used
Commodity channel index
Miscellaneous
It issuies visual alerts to the screen
15 Views
0 Downloads
0 Favorites
XO_ALERT_cci_cross_v2
//+------------------------------------------------------------------+
//|                                                    XO_EA_FTP.mq4 |
//|                                                          Kalenzo |
//|                                      bartlomiej.gorski@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Kalenzo"
#property link      "bartlomiej.gorski@gmail.com"
#property indicator_chart_window

extern int barToCheck = 1;
extern int cci = 34;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
  
  
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start(){
   static int dir = 0;
   static int mode = 0;

//----
   
   
   if(Bars>mode){
      double xo60g = iCustom(Symbol(),0,"ZZ  MTF  XO  A",60,5,0,barToCheck);//green 60
      double xo60r = iCustom(Symbol(),0,"ZZ  MTF  XO  A",60,5,1,barToCheck);//red 60

      double xo30g = iCustom(Symbol(),0,"ZZ  MTF  XO  A",30,6,0,barToCheck);//green 30
      double xo30r = iCustom(Symbol(),0,"ZZ  MTF  XO  A",30,6,1,barToCheck);//red 30

      double xo15g = iCustom(Symbol(),0,"ZZ  MTF  XO  A",15,5,0,barToCheck);//green 15
      double xo15r = iCustom(Symbol(),0,"ZZ  MTF  XO  A",15,5,1,barToCheck);//red 15

      double xo5g = iCustom(Symbol(),0,"ZZ  MTF  XO  A",5,5,0,barToCheck);//green 5
      double xo5r = iCustom(Symbol(),0,"ZZ  MTF  XO  A",5,5,1,barToCheck);//red 5

      double pxo60g = iCustom(Symbol(),0,"ZZ  MTF  XO  A",60,5,0,barToCheck+1);//green 60
      double pxo60r = iCustom(Symbol(),0,"ZZ  MTF  XO  A",60,5,1,barToCheck+1);//red 60

      double pxo30g = iCustom(Symbol(),0,"ZZ  MTF  XO  A",30,6,0,barToCheck+1);//green 30
      double pxo30r = iCustom(Symbol(),0,"ZZ  MTF  XO  A",30,6,1,barToCheck+1);//red 30

      double pxo15g = iCustom(Symbol(),0,"ZZ  MTF  XO  A",15,5,0,barToCheck+1);//green 15
      double pxo15r = iCustom(Symbol(),0,"ZZ  MTF  XO  A",15,5,1,barToCheck+1);//red 15

      double pxo5g = iCustom(Symbol(),0,"ZZ  MTF  XO  A",5,5,0,barToCheck+1);//green 5
      double pxo5r = iCustom(Symbol(),0,"ZZ  MTF  XO  A",5,5,1,barToCheck+1);//red 5

   
    
   
      //green open signal
      if(xo60g != 0 && xo30g != 0 && xo15g != 0 && xo5g != 0 && (pxo60g == 0 || pxo30g == 0 || pxo15g == 0 || pxo5g == 0) ){
         //Alert(Symbol()+" "+Period()+" XO Long ",Bid); 
         mode = Bars;
         dir = 1;
         }//red open signal
      else if(xo60r != 0 && xo30r != 0 && xo15r != 0 && xo5r != 0 && (pxo60r == 0 || pxo30r == 0 || pxo15r == 0 || pxo5r == 0) ){
         //Alert(Symbol()+" "+Period()+" XO Short ",Bid); 
         mode = Bars;
         dir = -1;
         }
      }   
   if(dir!=0){
      static int ltime = 0;
      if(ltime!=Bars){
         double cci0 = iCCI(NULL,0,cci,PRICE_CLOSE,barToCheck);
         double cci1 = iCCI(NULL,0,cci,PRICE_CLOSE,barToCheck+1);
         if(dir==1 && cci0>0 && cci1<0){
            ltime=Bars;
            Alert(Symbol()+" "+Period()+" XO Long ",Bid); 
            }
         else if(dir==-1 && cci0<0 && cci1>0){
            ltime=Bars;
            Alert(Symbol()+" "+Period()+" XO Short ",Bid); 
            } 
         }
      }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments