BykovTrend_Sig_v2

Download script
BykovTrend_Sig_v2

This script is designed as a visual trading tool for the MetaTrader platform, specifically created to identify potential trend shifts in price movement. Rather than showing a continuous line, it functions by placing directional signals directly on your chart to highlight when the market momentum changes from one direction to another.

Core Logic and Functionality

The script operates by monitoring a specific technical oscillator (the Williams Percent Range) to gauge the "overextended" nature of price movements. It looks for extreme boundaries in the market's price action to determine when a trend is becoming exhausted.

Here is how the underlying logic processes your data:

  • Trend Detection: The tool continuously scans historical and current price bars. It looks for specific numerical thresholds where the price movement becomes significantly overbought or oversold.
  • State Switching: The script maintains a "memory" of the current trend. It tracks whether the market is currently in an upward state or a downward state. A signal is only generated at the exact moment this state flips—moving from down to up, or up to down.
  • Signal Execution:
    • Buy Signals (Aqua): When the price movement hits a lower extreme threshold and begins to pivot upward, the script places an arrow marker below the low of the candle.
    • Sell Signals (Magenta): When the price movement hits an upper extreme threshold and begins to pivot downward, the script places an arrow marker above the high of the candle.

Key Customizations

The logic allows for three primary user-adjustable parameters to fine-tune the sensitivity:

  1. Risk Level: This adjusts the "buffer zone" for the signals. By changing this, you can make the script more aggressive (reacting faster to small changes) or more conservative (waiting for more significant trend shifts).
  2. SSP (Smoothing): This determines the timeframe of data used to calculate the price momentum. A higher number will smooth out "noise" in the market but may result in slightly delayed signals.
  3. Count Bars: This defines how much historical data the script should analyze on your chart at one time.

In summary, this tool serves as a visual filter that ignores minor market fluctuations and only alerts the user when the underlying momentum reaches a point of exhaustion and begins to reverse direction.

Indicators Used
Larry William percent range indicator
Miscellaneous
Implements a curve of type %1
15 Views
0 Downloads
0 Favorites
BykovTrend_Sig_v2
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//| 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;

//---- 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;
   
   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;}
   if ((! uptrend==old) && uptrend==false) {val1[i]=High[i]+5*Point;}
   old=uptrend;
      
      i--;
     }
   return(0);
  }
//+------------------------------------------------------------------+

Comments