PipNailer iSignals_v2
Download scriptThis script is a technical trading tool designed for the MetaTrader platform to identify potential market entry points by analyzing three different momentum and trend indicators simultaneously. Instead of relying on a single data point, it seeks "confluence"—a situation where multiple technical metrics agree on a specific market direction at the same time.
Core Logic Overview
The tool works by monitoring the relationship between current price action and three specific mathematical models:
- Parabolic SAR: Used to identify potential trend reversals and trailing stops.
- Awesome Clouds (AC): A momentum-based indicator that helps visualize the strength of a move.
- Awesome Oscillator (AO): A dual-timeframe momentum oscillator used to see the strength of price moves relative to a baseline.
How the Signals are Generated
The script scans the history of the charts and evaluates these three indicators to see if they have "flipped" or crossed specific thresholds.
- Buy Signals (Long): The script looks for a specific moment where all three indicators simultaneously shift from a bearish (downward) state to a bullish (upward) state. Specifically, it checks if the current value is higher than the previous one across all three models. When this triple-confirmation occurs, it places a "Long" signal on the chart.
- Sell Signals (Short): Conversely, if all three indicators simultaneously shift from a bullish state to a bearish state (all values dropping relative to their previous positions), the script identifies this as a "Short" signal and marks it on the chart.
Visual Representation
To make these signals easy for a trader to read, the script handles the visual placement automatically:
- Dynamic Offsetting: The script calculates the "noise" or volatility of the market using the ATR (Average True Range) indicator. It uses this calculation to ensure that the signal arrows do not overlap with the actual price candles.
- On-Chart Markers:
- Long Signals appear as blue arrows positioned slightly below the low of a candle.
- Short Signals appear as magenta arrows positioned slightly above the high of a candle.
Summary for the User
In simple terms, this script acts as a "filter." It ignores minor market fluctuations and only triggers a visual alert when three different mathematical perspectives all agree that a trend change is happening at once. This is designed to help traders identify high-probability moments where momentum is shifting in a clear direction.
//+------------------------------------------------------------------+
//| PipNailer iSignals_v2.mq4 |
//| © 2008 SwingMan |
//| |
//+------------------------------------------------------------------+
#property copyright "© 2008.04.16 SwingMan"
#property link ""
/*--------------------------------------------------------------------
- v2. 2008.04.16 Take only 300 bars
--------------------------------------------------------------------*/
#property indicator_chart_window
//---- extern inputs -------------------------------------------------
//- If your broker names the currency pairs with a suffix for a mini account (like an "m", for example), enter the suffix here
extern string SymbolSuffix = "";
//extern int refreshPeriod = PERIOD_M1; // refresh calcultion
extern double SAR_Step = 0.02;
extern double SAR_Max = 0.2;
//--------------------------------------------------------------------
#property indicator_buffers 2
#property indicator_color1 DeepSkyBlue // EntryLong
#property indicator_color2 Magenta // EntryShort
//---- constants
string windowsName = "PipNailer iSignals_v2";
int ShiftSignals = 1;
int Period_ATR = 21;
//---- variables
int TimeFrame;
datetime oldTime, thisTime;
bool CurrentTimeFrameOK;
//---- initialisations
int colDB_Pairs, colDB_Spread;
int colDB_Close, colDB_LastPrice;
int iColDB_First, colDB_M5, colDB_M15, colDB_M30, colDB_H1, colDB_H4, colDB_D1, colDB_W1;
//-- Signal buffers
double dClose[], dSAR[], dAC[], dAO[];
double LongSignal[], ShortSignal[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorDigits(Digits);
//---- indicators
ArraySetAsSeries(dClose,true);
ArraySetAsSeries(dSAR,true);
ArraySetAsSeries(dAC,true);
ArraySetAsSeries(dAO,true);
//---- signals
SetIndexBuffer(0, LongSignal);
SetIndexBuffer(1, ShortSignal);
SetIndexStyle(0,DRAW_ARROW,EMPTY,4);
SetIndexStyle(1,DRAW_ARROW,EMPTY,4);
SetIndexArrow(0, 233);
SetIndexArrow(1, 234);
//SetIndexLabel(0, NULL);
//SetIndexLabel(1, NULL);
SetIndexLabel(0, "LONG signal");
SetIndexLabel(1, "SHORT signal");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
ArrayResize(dClose,Bars);
ArrayResize(dSAR,Bars);
ArrayResize(dAC,Bars);
ArrayResize(dAO,Bars);
if (Time[0] == oldTime) return(0);
oldTime = Time[0];
int counted_bars=IndicatorCounted();
if(counted_bars < 0) return(-1);
if(counted_bars > 0) counted_bars--;
int limit=Bars-counted_bars;
int limit2 = limit;
//if (limit2 > 1) limit2 = 1;
if (limit2 < 100) limit2 = 100;
//----
//-- indicators
for (int i=0; i<limit2; i++) {
dClose[i] = iClose(Symbol(), Period(),i);
dSAR[i] = iSAR(Symbol(), Period(),SAR_Step,SAR_Max,i);
dAC[i] = iAC(Symbol(),Period(),i);
dAO[i] = iAO(Symbol(),Period(),i);
}
//-- signals
for (i=1; i<limit2; i++) {
//LongSignal[i] = EMPTY_VALUE;
//ShortSignal[i] = EMPTY_VALUE;
double dOffset = iATR(Symbol(),Period(),Period_ATR,i+1) * 0.40;
//if (i==1)
//Print("dClose=",dClose[i]);
//-- SAR
if (dClose[i] >= dSAR[i]) int iValue_SAR1 = 1; else iValue_SAR1 = -1;
if (dClose[i+1] >= dSAR[i+1]) int iValue_SAR2 = 1; else iValue_SAR2 = -1;
//-- AC
if (dAC[i] >= dAC[i+1]) int iValue_AC1 = 1; else iValue_AC1 = -1;
if (dAC[i+1] >= dAC[i+2]) int iValue_AC2 = 1; else iValue_AC2 = -1;
//-- AO
if (dAO[i] >= dAO[i+1]) int iValue_AO1 = 1; else iValue_AO1 = -1;
if (dAO[i+1] >= dAO[i+2]) int iValue_AO2 = 1; else iValue_AO2 = -1;
//-- signals
int iSignal_SAR=0, iSignal_AC=0, iSignal_AO=0, iOrderType=0;
if (iValue_SAR1 == 1 && iValue_SAR2 ==-1) iSignal_SAR = 1;
if (iValue_SAR1 == -1 && iValue_SAR2 ==1) iSignal_SAR = -1;
if (iValue_AC1 == 1 && iValue_AC2 ==-1) iSignal_AC = 1;
if (iValue_AC1 == -1 && iValue_AC2 ==1) iSignal_AC = -1;
if (iValue_AO1 == 1 && iValue_AO2 ==-1) iSignal_AO = 1;
if (iValue_AO1 == -1 && iValue_AO2 ==1) iSignal_AO = -1;
if(iSignal_SAR ==1 && iSignal_AC ==1 && iSignal_AO==1) iOrderType=1;
if(iSignal_SAR ==-1 && iSignal_AC ==-1 && iSignal_AO==-1) iOrderType=-1;
if (iOrderType == 1) LongSignal[i] = Low[i] - dOffset;
if (iOrderType == -1) ShortSignal[i] = High[i] + dOffset;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments