test4_show5ticks_v1

Download script
Author: Ron T
test4_show5ticks_v1

This tool is designed to help traders visualize specific price momentum shifts by identifying significant changes in a custom average price calculation. Instead of using standard moving averages that can sometimes lag, this script focuses on the relationship between three specific data points: the highest price (High), the lowest price (Low), and the closing price (Close) of each candle.

How the Logic Works

The script processes historical price data to determine a "typical" price value for every period. It then calculates the difference between this current value and the value from the previous period. Based on these differences, the tool generates visual signals on your chart:

  • Downside Momentum (Sell Signals): When the calculation shows a significant drop in the average price—specifically falling by more than 0.0005 units—the script places a red downward arrow. This serves as a visual cue that bearish momentum is increasing.
  • Upside Momentum (Buy Signals): Conversely, when the calculation detects a significant rise in the average price—exceeding 0.0005 units—the script places a white upward arrow. This indicates a shift toward bullish momentum.

Key Features for the User

  • Simplified Visualization: Rather than requiring you to interpret complex lines or curves, the tool converts raw price movement into clear, actionable symbols (arrows) directly on your trading window.
  • Filtered Sensitivity: By using a specific numerical threshold (0.0005), the script ignores minor "market noise" or tiny fluctuations, aiming to highlight only more substantial movements in price direction.
  • Historical Context: The tool scans back through a significant portion of your chart history, allowing you to see where previous trend shifts occurred and how the market reacted to those specific momentum changes.
Miscellaneous
Implements a curve of type %1
8 Views
0 Downloads
0 Favorites
test4_show5ticks_v1
//+------------------------------------------------------------------+
//|                                           MultiMovingAverage.mq4 |
//+------------------------------------------------------------------+
#property copyright "Ron T"
#property link      "http://www.lightpatch.com"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 White
#property indicator_color3 DeepSkyBlue

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//|------------------------------------------------------------------|

int init()
  {

   SetIndexStyle(0,DRAW_ARROW);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexArrow(0,234); //down red
   
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexBuffer(1, ExtMapBuffer2);
   SetIndexArrow(1,233); //up white

   SetIndexStyle(2,DRAW_ARROW);
   SetIndexBuffer(2, ExtMapBuffer3);
   SetIndexArrow(2,224);

   return(0);
  }


//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   int i;
   
   for( i=0; i<Bars; i++ ) ExtMapBuffer1[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer2[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer3[i]=0;

   return(0);
  }


//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   double curTYP=0;
   double oldTYP=0;
   double change=0;

   int pos=Bars/5;
   
   Print ("Start SHOW5TICKS with bars=",pos);

   while(pos>=0)
     {
      oldTYP=curTYP;
      curTYP=(High[pos]+Low[pos]+Close[pos])/3;
      change=curTYP-oldTYP;
      
      if ( change < -0.0005 )
        {
         ExtMapBuffer1[pos]=curTYP;  //up white
         ExtMapBuffer2[pos]=0;
         //Print ("would SELL here ",CurTime());
        }

      if ( change > 0.0005 )
        {
         ExtMapBuffer1[pos]=0;
         ExtMapBuffer2[pos]=curTYP;  //down red
         //Print ("would BUY  here ",CurTime());
        }

 	   pos--;
     }

   return(0);
  }
//+------------------------------------------------------------------+

Comments