AlaskanPipAssassinMod_v1
Download scriptThe SilverTrend script is a specialized technical analysis tool designed to help traders visualize price momentum and potential trend reversals by identifying key structural levels within a specific timeframe. Instead of simply following the current price, it analyzes historical data to determine significant boundaries.
How the Logic Works
Data Analysis Range The tool looks at a specific window of recent market activity (determined by the "CountBars" setting). By focusing on this specific range, the script filters out distant market noise and concentrates on what is happening in the current trend environment.
Identifying Extremes The core logic relies on scanning for the highest highs and lowest lows over a set period. By locating these peaks and valleys, the script establishes the "boundaries" of the current price movement. It effectively defines the territory where the market has recently lived.
Dynamic Threshold Calculation Rather than just marking the absolute high or low, the script calculates specific percentage-based levels based on two distinct variables:
- Lower Boundary: A conservative calculation used to identify potential support zones.
- Upper Boundary: A more aggressive calculation used to identify potential resistance zones.
By applying these mathematical offsets to the highest and lowest points found in the recent data, the script creates a "map" of price levels.
Visualizing the Trend
The indicator processes these calculations to produce two distinct lines on your chart:
- The Buy/Sell Signals: The logic compares the current calculated values against previous ones.
- Momentum Shifts: When the relationship between these calculated levels shifts, the script identifies a change in market sentiment. If the leading value suggests a move toward an upper boundary, it indicates a potential "Buy" environment; conversely, if it moves toward a lower boundary, it signals a "Sell" environment.
Summary for the Trader
In plain terms, this script acts as a guide for identifying where price might find resistance or support. It automatically calculates these zones based on recent volatility and provides real-time feedback on whether the current trend strength is leaning toward the top (bullish) or the bottom (bearish) of that specific trading range.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| SilverTrend .mq4 |
//| SilverTrend rewritten by CrazyChart |
//| http://viac.ru/ |
//+------------------------------------------------------------------+
#property copyright "SilverTrend rewritten by CrazyChart"
#property link "http://viac.ru/ "
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//---- input parameters
extern int CountBars=300;
extern int SSP=7;
extern double Kmin=1.6;
extern double Kmax=50.6; //24 21.6 21.6
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_LINE,0,2,Blue);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE,0,2,Red);
SetIndexBuffer(1,ExtMapBuffer2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
if (CountBars>=Bars) CountBars=Bars;
SetIndexDrawBegin(0,Bars-CountBars+SSP);
SetIndexDrawBegin(1,Bars-CountBars+SSP);
int i, i2,loopbegin,counted_bars=IndicatorCounted();
double SsMax, SsMin, K, val1, val2, smin, smax, price;
if(Bars<=SSP+1) return(0);
//---- initial zero
//K=33-RISK;
/*
if (firstTime==true) {
loopbegin = CountBars;
if (loopbegin>(Bars-2*SSP+1)) loopbegin=Bars-2*SSP+1;
firstTime=False;
}; ðóäèìåíò ñòàðîé ïðîãðàììû
*/
if(Bars<=SSP+1) return(0);
//---- initial zero
//+++++++
if(counted_bars<SSP+1)
{
for(i=1;i<=SSP;i++) ExtMapBuffer1[CountBars-i]=0.0;
for(i=1;i<=SSP;i++) ExtMapBuffer2[CountBars-i]=0.0;
}
//+++++++-SSP
for(i=CountBars-SSP;i>=0;i--) {
SsMax = High[Highest(NULL,0,MODE_HIGH,SSP,i-SSP+1)];
SsMin = Low[Lowest(NULL,0,MODE_LOW,SSP,i-SSP+1)];
smin = SsMin-(SsMax-SsMin)*Kmin/100;
smax = SsMax-(SsMax-SsMin)*Kmax/100;
ExtMapBuffer1[i-SSP+6]=smax;
ExtMapBuffer2[i-SSP-1]=smax;
val1 = ExtMapBuffer1[0];
val2 = ExtMapBuffer2[0];
if (val1 > val2) Comment("ïîêóïêà buy ",val1);
if (val1 < val2) Comment("ïðîäàæà sell ",val2);
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments