double up=iCustom(NULL,0,IndName,BarCount,MAPeriod,0,Shift);
double dn=iCustom(NULL,0,IndName,BarCount,MAPeriod,7,Shift);
bool buy = Close[Shift]<dn && Open[Shift]>dn;
bool sell = Close[Shift]>up && Open[Shift]<up;
//extern string IndName = "MA Chanels FIBO";
extern string IndName = "MA Chanels FIBO min";
//+------------------------------------------------------------------+
//| MA Chanels FIBO min.mq4 |
//| Copyright 2014, MetaQuotes Software Corp. |
//| http://www.mql5.com |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| MA Chanels.mq4 |
//| °njel° |
//| iamnotlinked |
//+------------------------------------------------------------------+
//http://zakaz.opentraders.ru/105580.html#comment166875
#property copyright "°njel°"
#property link "iamnotlinked"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color8 Red
//---- input parameters
extern int BarsCount = 500;
extern int MAPeriod=100;
extern int MAMethod=MODE_SMA;
extern int MAPrice=PRICE_CLOSE;
extern int fontsize=10;
double max =0;
double min =0;
double Inc2 = 0.0000;
double Inc3 = 0.0000;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer8[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexLabel(0,"61.8%");
SetIndexStyle(7,DRAW_LINE);
SetIndexBuffer(7,ExtMapBuffer8);
SetIndexLabel(7,"61.8%");
ObjectCreate("l1", OBJ_TEXT, 0, 0, 0);
ObjectSetText("l1", "61.8%",fontsize,"Arial",Red);
ObjectCreate("l8", OBJ_TEXT, 0, 0, 0);
ObjectSetText("l8", "61.8%",fontsize,"Arial",Red);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
max =0;
min =0;
ObjectDelete("l1");
ObjectDelete("l8");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
max =0;
min =0;
if (iBars(NULL,0) < BarsCount)
BarsCount = iBars(NULL,0) -MAPeriod-1 ;
for (int i =BarsCount; i>=0; i--)
{
double m = iMA(NULL,0,MAPeriod,0,MAMethod,MAPrice,i);
double top = High[i] - m;
if (top > max)
max = top;
double bottom = Low[i] - m;
if (bottom < min)
min = bottom;
}
if (MathAbs(max) > MathAbs(min))
Inc3 = max;
else
Inc3 = min;
Inc2 = Inc3*0.618;
for (i =BarsCount; i>=0; i--)
{
ExtMapBuffer1[i] = iMA(NULL,0,MAPeriod,0,MAMethod,MAPrice,i) + Inc2;
ExtMapBuffer8[i] = iMA(NULL,0,MAPeriod,0,MAMethod,MAPrice,i) - Inc2;
}
ObjectMove("l1", 0, Time[0],ExtMapBuffer1[0]);
ObjectMove("l8", 0, Time[0],ExtMapBuffer8[0]);
return(0);
}
//+------------------------------------------------------------------+
<code> extern string Symb="EURUSD"; </code>
<code>extern string Symb="EURUSD"; </code>
<code> if (OrderSymbol()!= Symb) continue; if (OrderMagicNumber()!= Magic) continue; if(OrderSymbol()==Symb && OrderMagicNumber()==Magic) </code>
if(CountTrades()<1 && Trade)
if(CountTrades()<1 && Trade && tr)
&& tr
if(CountTrades()<1 && Trade /*&& tr*/)
ssg