LeManSystem

Download script
Author: Copyright � 2009, LeMan.
LeManSystem

This script is an automated visual tool designed for trading platforms to help identify specific price patterns and potential reversal points on a market chart. Instead of relying on complex mathematical formulas, the logic focuses on identifying "pivot points"—specific moments where the price reaches a local high or low over a defined period.

Core Logic and Functionality

The script functions by scanning historical price data to locate significant peaks and valleys. It uses a user-defined lookback period (the "N" value) to determine how far back in time it should search to establish what constitutes a "high" or a "low."

Here is the breakdown of how it processes the market data:

  • Trend Identification: The tool looks at the relationship between consecutive price points. It specifically monitors whether the current price movement is breaking out from previous high/low zones or if it is retreating from them.
  • Buy Signal Detection (Upward Movement): The script identifies a potential "Up" signal when it detects that the price has dropped below a previous significant low and then subsequently broke back above a preceding high point. When these conditions align, it places a green arrow on the chart to highlight the entry point.
  • Sell Signal Detection (Downward Movement): Conversely, it identifies a "Down" signal when the price climbs above a previous significant high and then retreats below a preceding low. These moments are marked with red arrows to alert the user to a potential downward shift.
  • Dynamic Support and Resistance: Beyond just providing arrows, the script constantly calculates the lowest low and the highest high over the designated lookback period. It draws these as dynamic lines on your chart, which represent immediate areas of support (where price might stop falling) and resistance (where price might stop rising).

Summary for Traders

Essentially, this tool acts as a "scout." It filters through the noise of constant price fluctuations to highlight moments where the market shows a distinct change in momentum. By visually marking these transitions with colored arrows and drawing clear boundaries for support and resistance, it helps traders stay aware of key structural shifts in the market without having to manually calculate every price peak and valley.

Price Data Components
Series array that contains the lowest prices of each barSeries array that contains the highest prices of each bar
Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
LeManSystem
//+------------------------------------------------------------------+
//|                                                        LeMan.mq4 |
//|                                         Copyright © 2009, LeMan. |
//|                                                 b-market@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, LeMan."
#property link      "b-market@mail.ru"
//----
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 Green
#property indicator_color4 Red
#property indicator_width1 3
#property indicator_width2 3
//----
extern int    N = 12;
//----
double OpenUp[];
double OpenDown[];
double StopUp[];
double StopDn[];
//+------------------------------------------------------------------+
int init() {
//----
   IndicatorDigits(Digits);
   IndicatorBuffers(4);
//----      
   SetIndexBuffer(0,OpenUp);
   SetIndexBuffer(1,OpenDown);
   SetIndexBuffer(2,StopUp);
   SetIndexBuffer(3,StopDn);
   
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,159);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,159);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexStyle(3,DRAW_LINE);
//----      
   return(0);
}
//+------------------------------------------------------------------+
int start() { 

   int i, limit, counted_bars = IndicatorCounted();      
   if(counted_bars > 0) counted_bars--;
   limit = iBars(NULL,0)-counted_bars;

   for (i = 0; i < limit; i++) {
      OpenUp[i] = 0;
      OpenDown[i] = 0;
      double hl1 = iLow(NULL,0,iHighest(NULL,0,MODE_LOW,N,i+1));
      double hl2 = iLow(NULL,0,iHighest(NULL,0,MODE_LOW,N,i+2));
      double lh1 = iHigh(NULL,0,iLowest(NULL,0,MODE_HIGH,N,i+1));
      double lh2 = iHigh(NULL,0,iLowest(NULL,0,MODE_HIGH,N,i+2));
      if (Low[i+2] <= lh2 && Low[i+1] > lh1) {
         OpenUp[i] = High[i+1]+Point;
      }
      if (High[i+2] >= hl2 && High[i+1] < hl1) {
         OpenDown[i] = Low[i+1]-Point;
      }
      StopUp[i] = iLow(NULL,0,iLowest(NULL,0,MODE_LOW,N,i+1));
      StopDn[i] = iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,N,i+1));
   } 
   
//----
   return(0);
}
//+------------------------------------------------------------------+

Comments