Sidus_v1
Download scriptIndicator Overview
The Sidus indicator is a technical analysis tool designed for the MetaTrader platform. Its primary purpose is to identify potential trading opportunities by monitoring price trends and momentum through the interaction of multiple moving averages. It translates complex mathematical calculations into visual signals, such as arrows and lines, directly on your trading chart.
Core Components and Visuals
To provide a comprehensive view of market dynamics, the script utilizes several different types of moving averages:
- The Tunnel (EMA 18 & EMA 28): These are Exponential Moving Averages that serve as the primary trend boundaries. They help define the "corridor" in which price action typically moves.
- Short-Term Momentum (WMA 5 & WMA 8): These are Weighted Moving Averages, which react more quickly to recent price changes than the larger averages. They are used to identify immediate shifts in speed and direction.
Operational Logic
The indicator operates by comparing the current positions of these moving averages against their previous values to detect "crossings." When these lines intersect, it suggests a shift in market sentiment.
Buy Signals (Upward Momentum)
The script generates an upward-pointing arrow when specific bullish conditions are met:
- Momentum Crossover: When the fast short-term average (WMA 5) crosses above the slightly slower short-term average (WMA 8).
- Boundary Breakthrough: When the short-term average (WMA 8) breaks above the upper boundary of the main trend tunnel (EMA 28).
Sell Signals (Downward Momentum)
Conversely, the script generates a downward-pointing arrow to signal bearish pressure when:
- Momentum Reversal: When the fast short-term average (WMA 5) falls below the slower short-term average (WMA 8).
- Boundary Breakdown: When the short-term average (WMA 8) drops below the lower boundary of the main trend tunnel (EMA 28).
Adaptive Behavior
A unique feature of this script is its ability to adjust to different timeframes. It includes a dynamic "shift" calculation. This ensures that the visual signals (the arrows) are placed at an appropriate distance from the price candles regardless of whether you are viewing a 1-minute chart, a 1-hour chart, or a daily chart. This keeps the visual interface clean and ensures the signals remain readable across all types of trading environments.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| Sidus.mq4 |
//| Copyright © 2006, GwadaTradeBoy |
//| racooni_1975@yahoo.fr |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, GwadaTradeBoy"
#property link "racooni_1975@yahoo.fr"
#property indicator_chart_window
//----Section #property
#property indicator_buffers 7
#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_color3 Aqua
#property indicator_color4 Yellow
#property indicator_color5 Green
#property indicator_color6 Red
#property indicator_color7 Red
//---- Indicateurs
double EMA18, EMA28, WMA5, WMA8, tuncross;
double EMA18Current, EMA18Previous, EMA28Current, EMA28Previous;
double WMA5Current, WMA5Previous, WMA8Current, WMA8Previous;
extern double digit=0;
int nShift;
//---- buffers
double ExtMapBuffer1[]; //EMA18
double ExtMapBuffer2[]; //EMA28
double ExtMapBuffer3[]; //WMA5
double ExtMapBuffer4[]; //WMA8
double ExtMapBuffer5[]; //Fleche Haut
double ExtMapBuffer6[]; //Fleche Bas
double ExtMapBuffer7[]; //Croix
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//---- Styles et couleur des Lignes
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexStyle(3,DRAW_LINE);
//---- Styles et couleur des Fleches
SetIndexStyle(4, DRAW_ARROW, 0, 1); // Fleche vers le haut
SetIndexArrow(4, 233);
SetIndexBuffer(4, ExtMapBuffer5);
SetIndexStyle(5, DRAW_ARROW, 0, 1); // Fleche vers le bas
SetIndexArrow(5, 234);
SetIndexBuffer(5, ExtMapBuffer6);
SetIndexStyle(6, DRAW_ARROW, 0, 1); // Croix rouge fin de trade
SetIndexArrow(6, 251);
SetIndexBuffer(6, ExtMapBuffer7);
//----
switch(Period())
{
case 1: nShift = 1; break;
case 5: nShift = 3; break;
case 15: nShift = 5; break;
case 30: nShift = 10; break;
case 60: nShift = 15; break;
case 240: nShift = 20; break;
case 1440: nShift = 80; break;
case 10080: nShift = 100; break;
case 43200: nShift = 200; break;
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i,j,limit,counted_bars=IndicatorCounted();
//----
if(counted_bars<0)
return(-1);
if(counted_bars>0)
counted_bars--;
limit=Bars-counted_bars;
for(i=0; i<limit; i++)
{
EMA18Current=iMA(NULL,0,18,0,MODE_EMA,PRICE_CLOSE,i);
EMA18Previous=iMA(NULL,0,18,0,MODE_EMA,PRICE_CLOSE,i+1);
ExtMapBuffer1[i]=EMA18Current;
EMA28Current=iMA(NULL,0,28,0,MODE_EMA,PRICE_CLOSE,i);
EMA28Previous=iMA(NULL,0,28,0,MODE_EMA,PRICE_CLOSE,i+1);
ExtMapBuffer2[i]=EMA28Current;
WMA5Current=iMA(NULL,0,5,0,MODE_LWMA,PRICE_CLOSE,i);
WMA5Previous=iMA(NULL,0,5,0,MODE_LWMA,PRICE_CLOSE,i+1);
ExtMapBuffer3[i]=WMA5Current;
WMA8Current=iMA(NULL,0,8,0,MODE_LWMA,PRICE_CLOSE,i);
WMA8Previous=iMA(NULL,0,8,0,MODE_LWMA,PRICE_CLOSE,i+1);
ExtMapBuffer4[i]=WMA8Current;
//---- Dessin des fleches, future entré en trade
/* if ((EMA18Current > EMA28Current + digit*Point) &&( EMA18Previous <= EMA28Previous)) // Croisement Tunnel
{
tuncross = EMA18*/
//---- Buy
//if (WMA5Current > WMA8Current && WMA5Previous <= WMA8Previous)
/*-if (
//((EMA18Current > EMA28Current + digit*Point) &&( EMA18Previous <= EMA28Previous)) && // Croisement Tunnel
//((WMA5Current > WMA8Current + digit*Point) &&( WMA5Previous <= WMA8Previous)) && // Croisement WMA
//((WMA5Current > EMA18Current+ digit*Point) && ( WMA5Previous <= EMA18Current)) && // Croisement Bord1Tunnel WMA5
//((WMA5Current > EMA28Current+ digit*Point) && ( WMA5Previous <= EMA28Current)) && // Croisement Bord2 Tunnel WMA5
((WMA8Current > EMA18Current+ digit*Point) && ( WMA8Previous <= EMA18Current)) //&& // Croisement Bord1 Tunnel WMA8
//((WMA8Current > EMA28Current+ digit*Point) && ( WMA8Previous <= EMA28Current)) // Croisement Bord2 Tunnel WMA8
)*/
if((WMA5Current > WMA8Current+ digit*Point )&&(WMA5Previous<=WMA8Previous)) // Croisement WMA5 et WMA8, Lot = 10% de LotsOptimized()
{
ExtMapBuffer5[i] = Low[i] - nShift*Point;
}
if((WMA8Current > EMA28Current+ digit*Point) && ( WMA8Previous <= EMA28Current)) // Croisement WMA8 up bord supérieur du tunnel
{
ExtMapBuffer5[i] = Low[i] - nShift*Point;
}
//---- Sell
//if(WMA8Current > WMA5Current && WMA8Previous <= WMA5Previous)
/*if (
//((EMA18Current < EMA28Current + digit*Point) &&( EMA18Previous >= EMA28Previous)) && // Croisement Tunnel
//((WMA5Current < WMA8Current + digit*Point) &&( WMA5Previous >= WMA8Previous)) && // Croisement WMA
//((WMA5Current < EMA18Current+ digit*Point) && ( WMA5Previous <= EMA18Current)) && // Croisement Bord1Tunnel WMA5
//((WMA5Current < EMA28Current+ digit*Point) && ( WMA5Previous <= EMA28Current)) && // Croisement Bord2 Tunnel WMA5
//((WMA8Current < EMA18Current+ digit*Point) && ( WMA8Previous <= EMA18Current)) && // Croisement Bord1 Tunnel WMA8
((WMA8Current < EMA28Current+ digit*Point) && ( WMA8Previous <= EMA28Current)) // Croisement Bord2 Tunnel WMA8
)*/
if((WMA8Current > WMA5Current+ digit*Point )&&(WMA8Previous<=WMA5Previous)) // Croisement WMA5 et WMA8, Lot = 10% de LotsOptimized()
{
ExtMapBuffer6[i] = High[i] + nShift*Point;
}
if((EMA28Current > WMA8Current+ digit*Point) && ( WMA8Previous >= EMA28Current)) // Croisement WMA8 down bord inférieur du tunnel
{
ExtMapBuffer6[i] = High[i] + nShift*Point;
}
/*}*/
}
//---- Dessin des croix, future sortie en trade
//----
return(0);
}
//+------------------------------------------------------------------+
Comments