SilverBank
Download scriptThis script functions as a technical analysis tool designed to identify trend shifts and potential price reversal points on a trading chart. It works by analyzing historical price action over a specific timeframe to determine whether the market is currently in an upward or downward movement, and then highlights specific levels where traders might consider entering a position.
Core Operational Logic
1. Range and Volatility Analysis The tool begins by calculating the average range of price movement (the difference between highs and lows) over a defined number of past candles. This allows the script to understand the "normal" volatility of the current market environment, ensuring that its signals are scaled appropriately to the asset's behavior.
2. Dynamic Support and Resistance Mapping The script identifies the highest price reached (Maximum) and the lowest price reached (Minimum) within a specific look-back period. Using these two points, it calculates two dynamic boundaries:
- Upper Boundary: A high-level resistance point based on the maximum price reached.
- Lower Boundary: A low-level support point based on the minimum price reached.
These boundaries are not static; they shift and adapt as new price data becomes available, creating a "channel" that follows the market's current momentum.
3. Trend Detection The tool monitors the closing price of the candles relative to these dynamic boundaries:
- Bullish Sentiment: If the price closes above the upper boundary, the script recognizes an upward trend.
- Bearish Sentiment: If the price closes below the lower boundary, the script recognizes a downward trend.
When a shift occurs (e.g., the market flips from an upward trend to a downward trend), the tool marks the transition point by calculating a specific price level based on the average volatility range.
4. Signal Generation and Alerts The script compares these calculated entry levels to determine if a trade signal is valid. A signal is triggered when there is a significant "gap" or distance between the identified buy levels and sell levels.
- Buy Signals: Occur when the logic identifies an upward bias and a specific price level is established significantly above the sell threshold.
- Sell Signals: Occur when the logic identifies a downward bias and a specific price level is established significantly below the buy threshold.
Visual and User Interface Features
- On-Chart Markers: The tool plots visual lines and arrows to indicate trend direction and signal points directly on the trading screen.
- Real-time Commentary: It provides an on-screen text summary showing the current average volatility, the status of the trend (Up or Down), and the specific price level suggested for a potential trade.
- Audio/Visual Alerts: Users can enable an alert system that triggers a sound notification and a pop-up message whenever a new buy or sell signal is identified, preventing the need to watch the screen constantly.
//+------------------------------------------------------------------+
//| Filename changed to ForexOFFTrend.mq4 by CrazyChart & Lukas1 |
//| SilverBank .mq4 |
//| SilverBank changed by CrazyChart & Lukas1|
//| For 15 min & more long. idea from http://viac.ru/ |
//+------------------------------------------------------------------+
//àíãë. bank - ñóùåñòâèòåëüíîå: íàñûïü, îòêîñ; áåðåã; êðåí; áàíê; êîìïëåêò, íàáîð;
// âåðñòàê; ìåñòî õðàíåíèÿ çàïàñîâ; ðàçúåì äëÿ ïîäêëþ÷åíèÿ ïàìÿòè [êîìï.]
//
#property copyright "SilverTrend rewritten by CrazyChart"
#property link "http://viac.ru/ "
//----
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Aqua
#property indicator_color4 Violet
//---- input parameters
extern int CountBars = 5400;
extern int SSP = 21;
extern int Delta = 3;
extern double Kmin = 1.6;
extern double Kmax = 50.6;
extern bool gAlert = false; // Switch to allow alerts
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double Wal1[];
double Wal2[];
//----
bool gSellAlertGiven = false; // Used to stop constant alerts
bool gBuyAlertGiven = false; // Used to stop constant alerts
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(4);
SetIndexStyle(0, DRAW_LINE, 0, 2);
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexStyle(1, DRAW_LINE, 0, 2);
SetIndexBuffer(1, ExtMapBuffer2);
SetIndexStyle(2,DRAW_ARROW);
SetIndexArrow(2,233);
SetIndexStyle(3,DRAW_ARROW);
SetIndexArrow(3,234);
SetIndexBuffer(2,Wal1);
SetIndexBuffer(3,Wal2);
//----
if(CountBars >= Bars)
CountBars = Bars;
SetIndexDrawBegin(0, Bars - CountBars + SSP);
SetIndexDrawBegin(1, Bars - CountBars + SSP);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i, i1, i2, shift, loopbegin, counted_bars = IndicatorCounted();
double SsMax, SsMin, K, val1, val2, smin, smax, price;
double Range, AvgRange;
bool uptrend,old;
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;
for(i = 1; i <= SSP; i++) Wal1[CountBars-i] = 0.0;
for(i = 1; i <= SSP; i++) Wal2[CountBars-i] = 0.0;
}
for(i = CountBars - SSP; i >= 0; i--) // ìåíÿåì çäåñü
{
Range=0;
AvgRange=0;
for (i1=shift; i1<=shift+SSP; i1++)
{AvgRange=AvgRange+MathAbs(High[i1]-Low[i1]);
}
Range=AvgRange/(SSP+1);
SsMax = High[Highest(NULL, 0, MODE_HIGH, SSP, i - SSP + 1)];
SsMin = Low[Lowest( NULL, 0, MODE_LOW, SSP, i - SSP + 1)];
for (i2=shift;i2<=shift+SSP-1;i2++)
{
price=High[i2];
price=Low[i2];
}
smin = NormalizeDouble((SsMin - (SsMax - SsMin)*Kmin / 100), 6);
smax = NormalizeDouble((SsMax - (SsMax - SsMin)*Kmax / 100), 6);
ExtMapBuffer1[i-SSP+6] = smax;
ExtMapBuffer2[i-SSP-1] = smax;
val1 = ExtMapBuffer1[1];
val2 = ExtMapBuffer2[1];
Wal1[shift]=0;
Wal2[shift]=0;
if (Close[shift]<smin)
{
uptrend = false;
}
if (Close[shift]>smax)
{
uptrend = true;
}
if (uptrend!=old && uptrend==true) {Wal1[shift]=Low[shift]-Range*0.5;}
if (uptrend!=old && uptrend==false) {Wal2[shift]=High[shift]+Range*0.5;}
old=uptrend;
if(val1 > val2+Delta*Point)
{
Comment(" âîëàòèëüíîñòü: ",AvgRange/2,"\n"," òðåíä ââåðõ: ", uptrend," ìîæíî ïîêóïàòü îò ", val1);
if(gAlert == true && gBuyAlertGiven == false)
{
PlaySound("alert.wav");
Alert("Buy signal at " + DoubleToStr(val1, Digits) + " on " + Period() +
" minute chart");
gBuyAlertGiven = true;
gSellAlertGiven = false;
}
}
if(val1 < val2-Delta*Point)
{
Comment(" âîëàòèëüíîñòü: ",AvgRange/2,"\n"," òðåíä ââåðõ: ", uptrend," ìîæíî ïðîäàâàòü îò ", val2);
if(gAlert == true && gSellAlertGiven == false)
{
PlaySound("alert.wav");
Alert("Sell signal at " + DoubleToStr(val2, Digits) + " on " + Period()+
" minute chart");
gBuyAlertGiven = false;
gSellAlertGiven =true;
}
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments