profitsignalalert~

Download script
Author: Copyright � 2007 PipsLeader
profitsignalalert~

This technical script is designed as a market analysis tool for MetaTrader, specifically built to identify high-momentum trading opportunities by filtering out market "noise." It operates by synthesizing three distinct types of data: momentum velocity, price volatility, and structural trends.

Core Analytical Components

The logic relies on four primary metrics to evaluate the state of the market:

  • Momentum Velocity: The tool calculates the change in a moving average (MACD). By comparing current changes against previous ones and applying a "Sensitivity" multiplier, it determines how quickly price momentum is accelerating.
  • Volatility Expansion: It measures the width of price bands. This allows the script to see if the market is widening significantly (high volatility) or tightening.
  • Trend Strength: By comparing current price behavior against historical shifts, the tool calculates a percentage for both "Explosion Power" (sudden volatility spikes) and "Trend Power" (sustained directional movement).
  • Dead Zone Filtering: A customizable threshold is used to ignore minor price fluctuations, ensuring the tool only reacts to significant movements.

Operational Logic

The script continuously scans incoming price data and compares these four metrics against user-defined thresholds to trigger specific signals:

1. Entry Signals (Buy/Sell) To generate a signal, the script looks for a "perfect storm" of conditions simultaneously:

  • For a Buy: Momentum must be positive, velocity must be increasing, and the current volatility expansion must exceed the required "Explosion Power." It also ensures that the trend strength meets the minimum "Trend Power" percentage.
  • For a Sell: The logic is mirrored; it looks for negative momentum with accelerating downward velocity and sufficient explosive volatility expansion.

2. Exit Signals The tool also monitors for signs of exhaustion or reversal to notify the user when a position might be no longer viable:

  • Exit Buy: Triggered when momentum remains positive but begins to lose its acceleration (velocity drops) while staying within specific price boundaries.
  • Exit Sell: Triggered when downward momentum stays negative but fails to maintain its previous intensity.

User Notifications and Visuals

The script processes these calculations in real-time and provides the following outputs:

  • Visual Indicators: It plots histograms and lines on a separate window, allowing for a visual representation of momentum and volatility levels.
  • Smart Alerts: The script can send instant pop-up alerts or log entries into the terminal. These alerts are "intelligent" because they include calculated percentages for Trend Power and Explosion Power, giving the trader a quantitative measure of the move's strength.
  • Alert Management: It includes built-in counters to manage the frequency of notifications, preventing the user from being overwhelmed by repetitive alerts on the same price action.
Indicators Used
MACD HistogramBollinger bands indicator
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
10 Views
0 Downloads
0 Favorites
profitsignalalert~
/*
   Generated by EX4-TO-MQ4 decompiler ONE FILE V4.0.218.3
   EX4 ID : 04E20A41724C2645BAEB3FDF008C44EC
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "Copyright © 2007 PipsLeader"
#property link      "http://pipsleader.com"

#property indicator_separate_window
#property indicator_minimum 0.0
#property indicator_buffers 4
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 Sienna
#property indicator_color4 Blue

extern int Sensetive = 150;
extern int DeadZonePip = 30;
extern int ExplosionPower = 15;
extern int TrendPower = 15;
extern bool AlertWindow = TRUE;
extern int AlertCount = 500;
extern bool AlertLong = TRUE;
extern bool AlertShort = TRUE;
extern bool AlertExitLong = TRUE;
extern bool AlertExitShort = TRUE;
double g_ibuf_116[];
double g_ibuf_120[];
double g_ibuf_124[];
double g_ibuf_128[];
int gi_132 = 1;
int gi_136 = 1;
int gi_140 = 1;
int gi_144 = 1;
int gi_148 = 0;
int gi_152 = -1;
double g_ask_156;
double g_bid_164;

int init() {
   SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 2);
   SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 2);
   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexStyle(3, DRAW_LINE, STYLE_DOT, 1);
   SetIndexBuffer(0, g_ibuf_116);
   SetIndexBuffer(1, g_ibuf_120);
   SetIndexBuffer(2, g_ibuf_124);
   SetIndexBuffer(3, g_ibuf_128);
   IndicatorShortName("Pips Leader: [S(" + Sensetive + ") - DZ(" + DeadZonePip + ") - EP(" + ExplosionPower + ") - TP(" + TrendPower + ")]");
   Comment("copyright http://pipsleader.com");
   return (0);
}

int start() {
   double ld_0;
   double ld_8;
   double ld_16;
   double ld_24;
   double ld_32;
   double ld_40;
   double ld_48;
   int li_64 = IndicatorCounted();
   if (li_64 < 0) return (-1);
   if (li_64 > 0) li_64--;
   int li_56 = Bars - li_64;
   for (int l_shift_60 = li_56 - 1; l_shift_60 >= 0; l_shift_60--) {
      ld_0 = (iMACD(NULL, 0, 20, 40, 9, PRICE_CLOSE, MODE_MAIN, l_shift_60) - iMACD(NULL, 0, 20, 40, 9, PRICE_CLOSE, MODE_MAIN, l_shift_60 + 1)) * Sensetive;
      ld_8 = (iMACD(NULL, 0, 20, 40, 9, PRICE_CLOSE, MODE_MAIN, l_shift_60 + 2) - iMACD(NULL, 0, 20, 40, 9, PRICE_CLOSE, MODE_MAIN, l_shift_60 + 3)) * Sensetive;
      ld_16 = iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, l_shift_60) - iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, l_shift_60);
      ld_24 = iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, l_shift_60 + 1) - iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, l_shift_60 + 1);
      ld_32 = Point * DeadZonePip;
      g_ibuf_116[l_shift_60] = 0;
      g_ibuf_120[l_shift_60] = 0;
      g_ibuf_124[l_shift_60] = 0;
      g_ibuf_128[l_shift_60] = 0;
      if (ld_0 >= 0.0) g_ibuf_116[l_shift_60] = ld_0;
      if (ld_0 < 0.0) g_ibuf_120[l_shift_60] = -1.0 * ld_0;
      g_ibuf_124[l_shift_60] = ld_16;
      g_ibuf_128[l_shift_60] = ld_32;
      if (l_shift_60 == 0) {
         if (ld_0 > 0.0 && ld_0 > ld_16 && ld_0 > ld_32 && ld_16 > ld_32 && ld_16 > ld_24 && ld_0 > ld_8 && gi_132 < AlertCount && AlertLong == TRUE && Ask != g_ask_156) {
            ld_40 = 100.0 * (ld_0 - ld_8) / ld_0;
            ld_48 = 100.0 * (ld_16 - ld_24) / ld_16;
            g_ask_156 = Ask;
            if (ld_48 >= ExplosionPower && ld_40 >= TrendPower) {
               if (AlertWindow == TRUE) Alert(gi_132, "- ", Symbol(), " - BUY ", " (", DoubleToStr(g_ask_156, Digits), ") Trend PWR ", DoubleToStr(ld_40, 0), " - Exp PWR ", DoubleToStr(ld_48, 0));
               else Print(gi_132, "- ", Symbol(), " - BUY ", " (", DoubleToStr(g_ask_156, Digits), ") Trend PWR ", DoubleToStr(ld_40, 0), " - Exp PWR ", DoubleToStr(ld_48, 0));
               gi_132++;
            }
            gi_148 = 1;
         }
         if (ld_0 < 0.0 && MathAbs(ld_0) > ld_16 && MathAbs(ld_0) > ld_32 && ld_16 > ld_32 && ld_16 > ld_24 && MathAbs(ld_0) > MathAbs(ld_8) && gi_136 < AlertCount && AlertShort == TRUE &&
            Bid != g_bid_164) {
            ld_40 = 100.0 * (MathAbs(ld_0) - MathAbs(ld_8)) / MathAbs(ld_0);
            ld_48 = 100.0 * (ld_16 - ld_24) / ld_16;
            g_bid_164 = Bid;
            if (ld_48 >= ExplosionPower && ld_40 >= TrendPower) {
               if (AlertWindow == TRUE) Alert(gi_136, "- ", Symbol(), " - SELL ", " (", DoubleToStr(g_bid_164, Digits), ") Trend PWR ", DoubleToStr(ld_40, 0), " - Exp PWR ", DoubleToStr(ld_48, 0));
               else Print(gi_136, "- ", Symbol(), " - SELL ", " (", DoubleToStr(g_bid_164, Digits), ") Trend PWR ", DoubleToStr(ld_40, 0), " - Exp PWR ", DoubleToStr(ld_48, 0));
               gi_136++;
            }
            gi_148 = 2;
         }
         if (ld_0 > 0.0 && ld_0 < ld_16 && ld_0 < ld_8 && ld_8 > ld_24 && ld_0 > ld_32 && ld_16 > ld_32 && gi_140 <= AlertCount && AlertExitLong == TRUE && Bid != g_bid_164) {
            g_bid_164 = Bid;
            if (AlertWindow == TRUE) Alert(gi_140, "- ", Symbol(), " - Exit BUY ", " ", DoubleToStr(g_bid_164, Digits));
            else Print(gi_140, "- ", Symbol(), " - Exit BUY ", " ", DoubleToStr(g_bid_164, Digits));
            gi_148 = 3;
            gi_140++;
         }
         if (ld_0 < 0.0 && MathAbs(ld_0) < ld_16 && MathAbs(ld_0) < MathAbs(ld_8) && MathAbs(ld_8) > ld_24 && ld_0 > ld_32 && ld_16 > ld_32 && gi_144 <= AlertCount && AlertExitShort == TRUE &&
            Ask != g_ask_156) {
            g_ask_156 = Ask;
            if (AlertWindow == TRUE) Alert(gi_144, "- ", Symbol(), " - Exit SELL ", " ", DoubleToStr(g_ask_156, Digits));
            else Print(gi_144, "- ", Symbol(), " - Exit SELL ", " ", DoubleToStr(g_ask_156, Digits));
            gi_148 = 4;
            gi_144++;
         }
         gi_152 = gi_148;
      }
      if (gi_148 != gi_152) {
         gi_132 = 1;
         gi_136 = 1;
         gi_140 = 1;
         gi_144 = 1;
      }
   }
   return (0);
}

Comments