BykovTrend_Sig_v4
Download scriptThis tool is designed to identify specific trend reversals on a trading chart by monitoring price momentum and volatility. Instead of providing a continuous line, it acts as a visual signaling system that marks entry points where the market sentiment shifts from bearish to bullish, or vice versa.
Core Logic Overview
The script operates by analyzing a specific momentum oscillator (known as WPR) over a defined period of time. It looks for extreme "overbought" or "oversold" conditions to determine when the price has moved too far in one direction and is likely to pivot.
How it Identifies Signals
- Trend Tracking: The tool constantly monitors the momentum values. It establishes a "Risk" threshold that acts as a filter; this prevents the tool from generating false signals during choppy, sideways markets by requiring a significant move before a trend change is confirmed.
- Directional Detection:
- Bullish Signals: When the momentum moves from a negative state to a positive state (crossing above the established threshold), the tool identifies a potential upward trend. It then places an Aqua-colored arrow below the price candle to signal this shift.
- Bearish Signals: Conversely, when the momentum drops from a positive state into a deep negative territory (dropping below the bottom threshold), it recognizes a downward trend and places a Magenta-colored arrow above the price candle.
- Visual Filtering: To keep the chart clean and relevant, the script is programmed to only display signals within a specific window of recent history (the "CountBars" parameter), ensuring you are focusing on current market conditions rather than outdated data.
User Experience
For the trader, this means the visual interface simplifies complex momentum math into two clear actions:
- Aqua Arrows suggest that the downward pressure has exhausted and an upward move may be beginning.
- Magenta Arrows suggest that the upward momentum has peaked and a downward move may be starting.
The script also includes internal logic to manage alerts, ensuring that notifications are handled efficiently without overwhelming the user with repetitive pings during a single trend shift.
//+------------------------------------------------------------------+
//| BykovTrend_Sig.mq4 |
//| Ramdass - Conversion only |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Magenta
#property indicator_color2 Aqua
//---- input parameters
extern int RISK=3;
extern int SSP=9;
extern int CountBars=500;
extern int Alert_Delay_In_Seconds=60;
int PrevAlertTime=0;
//---- buffers
double val1[];
double val2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- indicator line
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,234);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,233);
SetIndexBuffer(0,val1);
SetIndexBuffer(1,val2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| BykovTrend_Sig |
//+------------------------------------------------------------------+
int start()
{
SetIndexDrawBegin(0,Bars-CountBars+SSP+1);
SetIndexDrawBegin(1,Bars-CountBars+SSP+1);
int i,counted_bars=IndicatorCounted();
int K;
bool uptrend,old;
double wpr;
int A=10;
//----
K=33-RISK;
//----
if(Bars<=SSP+1) return(0);
//---- initial zero
if(counted_bars<SSP+1)
{
for(i=1;i<=0;i++) val1[CountBars-i]=0.0;
for(i=1;i<=0;i++) val2[CountBars-i]=0.0;
}
//----
i=CountBars-SSP-1;
if(counted_bars>=SSP+1) i=CountBars-counted_bars-1;
while(i>=0)
{
wpr=iWPR(NULL,0,SSP,i);
val1[i]=0.0; val2[i]=0.0;
if (wpr<-100+K) uptrend=false;
if (wpr>-K) uptrend=true;
if ((! uptrend==old) && uptrend==true) {val2[i]=Low[i]-5*Point;}
//----
PrevAlertTime=CurTime();
//----
if ((! uptrend==old) && uptrend==false) {val1[i]=High[i]+5*Point;}
old=uptrend;
i--;
}
return(0);
}
//+------------------------------------------------------------------+
Comments