Author: Copyright (c) 2009,KurlFX
melkl

This tool is designed as a visual technical indicator for the MetaTrader platform to help traders identify potential entry points based on specific price movements. Instead of overwhelming the user with complex data, it focuses on highlighting clear structural shifts in the market.

Core Logic and Functionality

Signal Detection The script monitors the relationship between consecutive price candles to detect a specific "squeeze" or momentum shift. It looks for a pattern where:

  • The highs of the candles are steadily increasing over a three-bar sequence.
  • Simultaneously, the lows of those same candles are steadily decreasing.

When these conditions are met together, it identifies a high-volatility moment where the market is expanding in both directions, signaling a potential breakout or trend reversal point.

Visual Entry Points Once the pattern is detected, the indicator automatically places two distinct markers on your chart:

  • Buy Entry: A green arrow indicating a suggested purchase price, calculated by taking the peak of the signal candles and adding a specific buffer.
  • Sell Entry: A red arrow indicating a suggested selling price, calculated by taking the floor of the signal candles and subtracting a specific buffer.

Dynamic Dashboard Information The script doesn't just show arrows; it provides real-time data updates on your screen to help with trade management:

  • Price Updates: It displays the exact Ask and Bid prices for both the Buy and Sell entries directly on the chart labels.
  • Risk Assessment: It automatically calculates the "Risk" in pips between the proposed Buy and Sell levels. This allows a trader to instantly see the potential range of the move, helping to determine if the risk-to-reward ratio is favorable before opening a position.

Clean Chart Management To ensure a smooth user experience, the script includes an automatic cleanup system. When you remove the indicator from your chart, it automatically deletes all labels and markers it created, leaving your workspace clean and uncluttered for your next analysis.

Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
melkl
//5/7/09
//+------------------------------------------------------------------+
//|	myentrylines.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright (c) 2009,KurlFX"
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 Green
#property indicator_color4 Red
#define GP 15
//--buffers
double BE[];
double SE[];
double BB[];
double SS[];
//rev
int PAP;
color Bcol=Green,Scol=Red,Col=Gray;
string Unq="melkl-",nmBE,nmSE,nmRisk;
//+------------------------------------------------------------------+
//| init                                                  |
//+------------------------------------------------------------------+
int init()
{
	SetIndexBuffer(0, BE);
	SetIndexBuffer(1, SE);

	SetIndexLabel(0,NULL);
	SetIndexLabel(1,NULL);

   SetIndexStyle(0, DRAW_ARROW);
   SetIndexArrow(0,225);
   SetIndexStyle(1, DRAW_ARROW);
   SetIndexArrow(1,226);

//--rev
	SetIndexBuffer(2, BB);
	SetIndexBuffer(3, SS);

	SetIndexLabel(2,"BuyEntry");
	SetIndexLabel(3,"SellEntry");

	if(MathMod(Digits,2)==0)PAP=1;else PAP=10;

	nmBE=Unq+"BuyEntry";Dlbl(nmBE," ",1,2,2,Bcol,9);
	nmSE=Unq+"SellEntry";Dlbl(nmSE," ",1,2,14,Scol,9);
	nmRisk=Unq+"Risk";Dlbl(nmRisk," ",1,2,26,Col,9);

	return(0);
}
//+------------------------------------------------------------------+
//| deinit                                                  |
//+------------------------------------------------------------------+
int deinit()
{
	int obj_total=ObjectsTotal();
	string name;
	int ln=StringLen(Unq);
	for(int i=0;i<obj_total;i++)
	{
		name=ObjectName(obj_total-1-i);
		if(StringSubstr(name,0,ln)==Unq)ObjectDelete(name);
	}
	Comment("");
	return(0);	
}
//+------------------------------------------------------------------+
//| main|
//+------------------------------------------------------------------+
int start()
{
	int cntbar=IndicatorCounted();
	int limit=Bars-cntbar;
	if(cntbar==0){limit-=3;BB[limit]=EMPTY_VALUE;SS[limit]=EMPTY_VALUE;}
	for(int i=limit-1;i>=0;i--)
	{
		BE[i] = EMPTY_VALUE;
		SE[i] = EMPTY_VALUE;

		if(High[i+3]>High[i+2]&&High[i+2]>High[i+1]&&Low[i+3]<Low[i+2]&&Low[i+2]<Low[i+1])
		{
			double be,se;
			be= High[i+2]+GP*PAP*Point;
			se=Low[i+2]-GP*PAP*Point;
			BE[i]=be;be+=Ask-Bid;
			SE[i]=se;
			ObjectSetText(nmBE,"buy(Ask): > "+DoubleToStr(be,Digits));
			ObjectSetText(nmSE,"sell(Bid): < "+DoubleToStr(se,Digits));
			ObjectSetText(nmRisk,"risk-: "+DoubleToStr((be-se)/Point/PAP,0)+"pips");
		}
		
		if(BE[i]!=EMPTY_VALUE)BB[i]=BE[i];else BB[i]=BB[i+1];
		if(SE[i]!=EMPTY_VALUE)SS[i]=SE[i];else SS[i]=SS[i+1];
	}
	return(0);
}
//+------------------------------------------------------------------+
//|	Create Objects				|
//+------------------------------------------------------------------+
void Dlbl(string name,string txt,int corner,int x,int y,color col,int fontsz)
{
	ObjectCreate(name,OBJ_LABEL,0,0,0);
	ObjectSetText(name,txt,fontsz,"Arial",col);
	ObjectSet(name,OBJPROP_CORNER,corner);
	ObjectSet(name,OBJPROP_YDISTANCE,y);
	ObjectSet(name,OBJPROP_XDISTANCE,x);
}
//+------------------------------------------------------------------

Comments