//+------------------------------------------------------------------+
//| Percentage Line.mq4 |
//| Al Mo |
//|
Forex Trading Software: Forex Trading Platform MetaTrader 4 |
//+------------------------------------------------------------------+
#property copyright "Al Molina"
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow
//---- buffers
double PercentLine[];
extern double Percent= 0.382;
extern int barsback = 2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,PercentLine);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
for( int i = Bars-counted_bars-1; i>=0; i--)
{
PercentLine[i] = High[iHighest(NULL,0,MODE_HIGH,barsback,i)]- (High[iHighest(NULL,0,MODE_HIGH,barsback,i)]-Low[iLowest(NULL,0,MODE_LOW,barsback,i)]) *Percent;
}
//----
//----
return(0);
}
//+------------------------------------------------------------------+