Deprecated: Assigning the return value of new by reference is deprecated in /home/forex/public_html/wp-settings.php on line 520

Deprecated: Assigning the return value of new by reference is deprecated in /home/forex/public_html/wp-settings.php on line 535

Deprecated: Assigning the return value of new by reference is deprecated in /home/forex/public_html/wp-settings.php on line 542

Deprecated: Assigning the return value of new by reference is deprecated in /home/forex/public_html/wp-settings.php on line 578

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/forex/public_html/wp-settings.php on line 18
1-0 :forex decode

1-0 Archives

Ind-TD-DeMark-3-1

//+——————————————————————+
//| Ind-TD-DeMark-3-1.mq4 |
//| Copyright © 2005,Kara Software Corp. |
//| |
//+——————————————————————+
#property copyright “Copyright © 2005, Kara Software Corp.”
#property link “”
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 White /*Original #property indicator_color1 Red. Color of Upper TD Points*/
#property indicator_color2 White /*Original #property indicator_color2 Blue. Color of Lower TD Points*/
//—- input parameters
/* Mod 02: only one step, no back steps, only one target, no fractal trendlines,
no large arrow option for TD points, and added user changable colours and styles*/
/* Mod 03: Alerts Added. Horizontal Lines indicating where projections start from and
where alerts should be determined from re-enabled with Default of False.*/
/* Mod 03B: Bug where TD Points and TD Lines drawn in wrong place for
double, triple and quadruple tops or bottoms is fixed*/

extern bool AlertsOn = false; // Line added. Default is true.
extern bool Comments=False;/*Optional Comments. Default is false. Orginal variable called “Commen”*/
extern bool TrendLine=True;/*Default is true to draw current TD Lines*/
extern int TrendLineStyle=STYLE_SOLID;/*STYLE>_SOLID=0,DASH=1,_DOT=2,_DASHDOT=3,_DASHDDOTDOT=4. Line of code added from original.*/
extern int TrendLineWidth=1;/*Thinnest or allow dots and dashes = 0 or 1, Thinner=2, Medium=3,Thicker=4,Thickest=5. Line of code added from original.*/
extern color UpperTrendLineColour=Red;/*Line of code added from original.*/
extern color LowerTrendLineColour=Blue;/*Line of code added from original.*/
extern bool ProjectionLines=True;/*Default is True. These are the TD Price Projections. Original variable called “Take Prof”*/
extern int ProjectionLinesStyle=STYLE_DASH;/*STYLE>_SOLID=0,DASH=1,_DOT=2,_DASHDOT=3,_DASHDDOTDOT=4. Line of code added from original.*/
extern int ProjectionLinesWidth=1;/*Thinnest or allow dots and dashes = 0 or 1, Thinner=2, Medium=3,Thicker=4,Thickest=5. Line of code added from original.*/
extern color UpperProjectionLineColour=Yellow;/*Line of code added from original.*/
extern color LowerProjectionLineColour=Yellow;/*Line of code added from original.*/
extern bool HorizontLine=False;/*Default is false. It seems the Horizontal Lines are were the code predicts price may cross TD line.*/

bool TD=False;/*Default is false. True setting draws up and down arrows instead of dots on TD Points creating more clutter.*/
int BackSteps=0;/*Used to be extern int now just int. Leave at 0*/
int ShowingSteps=1;/*Used to be extern int now just int. Leave at 1*/
bool FractalAsTD=false;/*Used to be extern bool now just bool. Leave at false, otherwise Trend Lines based on Fractal Points not TD Points*/

double TrendLineBreakUp=-1;//Line added.
bool TrendLineBreakUpFlag=False;//Line added.
double TrendLineBreakDown=-1;//Line added.
bool TrendLineBreakDownFlag=False;//Line added.

//—- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//====================================================================
int init()
{
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,217);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,218);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexEmptyValue(1,0.0);
for (int i=1;i<=10;i++)
{
ObjectDelete("HHL_"+i);ObjectDelete("HL_"+i);
ObjectDelete("HLL_"+i);ObjectDelete("LL_"+i);
ObjectDelete("HC1_"+i);
ObjectDelete("HC2_"+i);
ObjectDelete("HC3_"+i);
ObjectDelete("LC1_"+i);
ObjectDelete("LC2_"+i);
ObjectDelete("LC3_"+i);
}
Comment("");
return(0);
}
int deinit()
{
for (int i=1;i<=10;i++)
{
ObjectDelete("HHL_"+i);ObjectDelete("HL_"+i);
ObjectDelete("HLL_"+i);ObjectDelete("LL_"+i);
ObjectDelete("HC1_"+i);
ObjectDelete("HC2_"+i);
ObjectDelete("HC3_"+i);
ObjectDelete("LC1_"+i);
ObjectDelete("LC2_"+i);
ObjectDelete("LC3_"+i);
}
Comment("");
return(0);
}
//--------------------------------------------------------------------
int SetTDPoint(int B)//It seems B is the same as IndicatorCounted() function
{
int shift;
if (FractalAsTD==false)
{
//Print("B = ",B);
//Print("Bars = ",Bars);
//Print("IndicatorCounted() = ",IndicatorCounted());
for (shift=B;shift>1;shift–)
{
if (High[shift+1] ExtMapBuffer2[shift]=Low[shift];//I added for triple bottom

if (Low[shift+4]>Low[shift] && Low[shift+3]==Low[shift]&& Low[shift+2]==Low[shift] && Low[shift+1]==Low[shift]//I added for quadruple bottom
&& Low[shift-1]>Low[shift])//I added for quadruple bottom
ExtMapBuffer2[shift]=Low[shift];//I added for quadruple bottom

if (Low[shift-1]<=Low[shift])//I added
ExtMapBuffer2[shift]=0;//I added

//else ExtMapBuffer2[shift]=0;
}
ExtMapBuffer1[0]=0;
ExtMapBuffer2[0]=0;
ExtMapBuffer1[1]=0;
ExtMapBuffer2[1]=0;
}
else
{
for (shift=B;shift>3;shift–)
{
if (High[shift+1]<=High[shift] && High[shift-1] ExtMapBuffer1[shift]=High[shift];
else ExtMapBuffer1[shift]=0;
if (Low[shift+1]>=Low[shift] && Low[shift-1]>Low[shift] && Low[shift+2]>=Low[shift] && Low[shift-2]>Low[shift])
ExtMapBuffer2[shift]=Low[shift];
else ExtMapBuffer2[shift]=0;
}
ExtMapBuffer1[0]=0;
ExtMapBuffer2[0]=0;
ExtMapBuffer1[1]=0;
ExtMapBuffer2[1]=0;
ExtMapBuffer1[2]=0;
ExtMapBuffer2[2]=0;
}
return(0);
}
//——————————————————————–
int GetHighTD(int P)
{
int i=0,j=0;
while (j {
i++;
while(ExtMapBuffer1[i]==0)
{i++;if(i>Bars-2)return(-1);}
j++;
}
return (i);
}
//——————————————————————–
int GetNextHighTD(int P)
{
int i=P+1;
while(ExtMapBuffer1[i]<=High[P]){i++;if(i>Bars-2)return(-1);}
return (i);
}
//——————————————————————–
int GetLowTD(int P)
{
int i=0,j=0;
while (j {
i++;
while(ExtMapBuffer2[i]==0)
{i++;if(i>Bars-2)return(-1);}
j++;
}
return (i);
}
//——————————————————————–
int GetNextLowTD(int P)
{
int i=P+1;
while(ExtMapBuffer2[i]>=Low[P] || ExtMapBuffer2[i]==0){i++;if(i>Bars-2)return(-1);}
return (i);
}
//——————————————————————–
int TrendLineHighTD(int H1,int H2,int Step,int Col)/*Draw Upper Trend Line*/
{
ObjectSet(”HL_”+Step,OBJPROP_TIME1,Time[H2]);ObjectSet(”HL_”+Step,OBJPROP_TIME2,Time[H1]);
ObjectSet(”HL_”+Step,OBJPROP_PRICE1,High[H2]);ObjectSet(”HL_”+Step,OBJPROP_PRICE2,High[H1]);
ObjectSet(”HL_”+Step,OBJPROP_COLOR,UpperTrendLineColour);/*TEMP Original OBJPROP_COLOR,Col*/
if (Step==1)ObjectSet(”HL_”+Step,OBJPROP_WIDTH,TrendLineWidth);/*Original OBJPROP_WIDTH,2*/
else ObjectSet(”HL_”+Step,OBJPROP_WIDTH,1);
return(0);
}
//——————————————————————–
int TrendLineLowTD(int L1,int L2,int Step,int Col)/*Draw Lower Trend Line*/
{
ObjectSet(”LL_”+Step,OBJPROP_TIME1,Time[L2]);ObjectSet(”LL_”+Step,OBJPROP_TIME2,Time[L1]);
ObjectSet(”LL_”+Step,OBJPROP_PRICE1,Low[L2]);ObjectSet(”LL_”+Step,OBJPROP_PRICE2,Low[L1]);
ObjectSet(”LL_”+Step,OBJPROP_COLOR,LowerTrendLineColour);/*TEMP Original OBJPROP_COLOR,Col*/
if (Step==1)ObjectSet(”LL_”+Step,OBJPROP_WIDTH,TrendLineWidth);/*Original OBJPROP_WIDTH,2*/
else ObjectSet(”LL_”+Step,OBJPROP_WIDTH,1);
return(0);
}
//——————————————————————–
int HorizontLineHighTD(int H1,int H2,int Step,double St,int Col)
{
ObjectSet(”HHL_”+Step,OBJPROP_PRICE1,High[H2]-(High[H2]-High[H1])/(H2-H1)*H2);//HORIZONTAL HIGH LINE HEIGHT CALCULATION
ObjectSet(”HHL_”+Step,OBJPROP_STYLE,St);
ObjectSet(”HHL_”+Step,OBJPROP_COLOR,Col);
ObjectSet(”HHL_”+Step,OBJPROP_BACK,True);//Line added
return(0);
}
//——————————————————————–
int HorizontLineLowTD(int L1,int L2,int Step,double St,int Col)
{

ObjectSet(”HLL_”+Step,OBJPROP_PRICE1,Low[L2]+(Low[L1]-Low[L2])/(L2-L1)*L2);//HORIZONTAL LOW LINE HEIGHT CALCULATION
ObjectSet(”HLL_”+Step,OBJPROP_STYLE,St);
ObjectSet(”HLL_”+Step,OBJPROP_COLOR,Col);
ObjectSet(”HLL_”+Step,OBJPROP_BACK,True);//Line added
return(0);
}
//——————————————————————–
string TakeProfitHighTD(int H1,int H2,int Step,int Col)/*Draw Buy TD Price Projection(s)*/
{
int i,ii,j=0;
string Comm=”";
double kH,HC1,HC2,HC3,k,St;
kH=(High[H2]-High[H1])/(H2-H1);
while (NormalizeDouble(Point,j)==0)j++;
k=0;
for(i=H1;i>0;i–)if(Close[i]>High[H2]-kH*(H2-i)){k=High[H2]-kH*(H2-i);break;}
if (k>0)
{
Comm=Comm+”UTD_Line (”+DoubleToStr(High[H2]-kH*H2,j)+”) broken at “+DoubleToStr(k,j)+”, uptargets:\n”;
ii=Lowest(NULL,0,MODE_LOW,H2-i,i);
HC1=High[H2]-kH*(H2-ii)-Low[ii];
HC2=High[H2]-kH*(H2-ii)-Close[ii];
ii=Lowest(NULL,0,MODE_CLOSE,H2-i,i);
HC3=High[H2]-kH*(H2-ii)-Close[ii];
St=TrendLineStyle;/*Original STYLE_SOLID*/
}
else
{
k=High[H2]-kH*H2;
Comm=Comm+”UTD_Line (”+DoubleToStr(k,j)+”), probable break-up targets:\n”;
ii=Lowest(NULL,0,MODE_LOW,H2,0);
HC1=High[H2]-kH*(H2-ii)-Low[ii];
HC2=High[H2]-kH*(H2-ii)-Close[ii];
ii=Lowest(NULL,0,MODE_CLOSE,H2,0);
HC3=High[H2]-kH*(H2-ii)-Close[ii];
St=TrendLineStyle;/*Original STYLE_DASHDOT*/
}
ObjectSet(”HL_”+Step,OBJPROP_STYLE,St);
Comm=Comm+”T1=”+DoubleToStr(HC1+k,j)+” (”+DoubleToStr(HC1/Point,0)+”pts.)\n”;//changed “pts.)” to “pts.)\n”
//Comm=Comm+” T2=”+DoubleToStr(HC2+k,j)+” (”+DoubleToStr(HC2/Point,0)+”pts.)”;
//Comm=Comm+” T3=”+DoubleToStr(HC3+k,j)+” (”+DoubleToStr(HC3/Point,0)+”pts.)\n”;
ObjectSet(”HC1_”+Step,OBJPROP_TIME1,Time[H1]);ObjectSet(”HC1_”+Step,OBJPROP_TIME2,Time[0]);
ObjectSet(”HC1_”+Step,OBJPROP_PRICE1,HC1+k);ObjectSet(”HC1_”+Step,OBJPROP_PRICE2,HC1+k);
ObjectSet(”HC1_”+Step,OBJPROP_COLOR,Col);ObjectSet(”HC1_”+Step,OBJPROP_STYLE,St);
//ObjectSet(”HC2_”+Step,OBJPROP_TIME1,Time[H1]);ObjectSet(”HC2_”+Step,OBJPROP_TIME2,Time[0]);
//ObjectSet(”HC2_”+Step,OBJPROP_PRICE1,HC2+k);ObjectSet(”HC2_”+Step,OBJPROP_PRICE2,HC2+k);
//ObjectSet(”HC2_”+Step,OBJPROP_COLOR,Col);ObjectSet(”HC2_”+Step,OBJPROP_STYLE,St);
//ObjectSet(”HC3_”+Step,OBJPROP_TIME1,Time[H1]);ObjectSet(”HC3_”+Step,OBJPROP_TIME2,Time[0]);
//ObjectSet(”HC3_”+Step,OBJPROP_PRICE1,HC3+k);ObjectSet(”HC3_”+Step,OBJPROP_PRICE2,HC3+k);
//ObjectSet(”HC3_”+Step,OBJPROP_COLOR,Col);ObjectSet(”HC3_”+Step,OBJPROP_STYLE,St);
if (Step==1)
{
ObjectSet(”HC1_”+Step,OBJPROP_WIDTH,ProjectionLinesWidth);/*Original OBJPROP_WIDTH,2*/
ObjectSet(”HC1_”+Step,OBJPROP_STYLE,ProjectionLinesStyle);/*This Line of code added from original. TD Upper Projection Line Style*/
// ObjectSet(”HC2_”+Step,OBJPROP_WIDTH,2);
// ObjectSet(”HC3_”+Step,OBJPROP_WIDTH,2);
}
else
{
ObjectSet(”HC1_”+Step,OBJPROP_WIDTH,2);
// ObjectSet(”HC2_”+Step,OBJPROP_WIDTH,2);
// ObjectSet(”HC3_”+Step,OBJPROP_WIDTH,2);
}
return(Comm);
}
//——————————————————————–
string TakeProfitLowTD(int L1,int L2,int Step,int Col)/*Draw Sell TD Price Projection(s)*/
{
int i,ii,j=0;
string Comm=”";
double kL,LC1,LC2,LC3,k,St;
kL=(Low[L1]-Low[L2])/(L2-L1);
while (NormalizeDouble(Point,j)==0)j++;
k=0;
for(i=L1;i>0;i–)if(Close[i] if (k>0)
{
Comm=Comm+”LTD_Line (”+DoubleToStr(Low[L2]+kL*L2,j)+”) broken at “+DoubleToStr(k,j)+”, downtargets:\n”;
ii=Highest(NULL,0,MODE_HIGH,L2-i,i);
LC1=High[ii]-(Low[L2]+kL*(L2-ii));
LC2=Close[ii]-(Low[L2]+kL*(L2-ii));
i=Highest(NULL,0,MODE_CLOSE,L2-i,i);
LC3=Close[ii]-(Low[L2]+kL*(L2-ii));
St=TrendLineStyle;/*Original STYLE_SOLID*/
}
else
{
k=Low[L2]+kL*L2;
Comm=Comm+”LTD_Line (”+DoubleToStr(k,j)+”), probable downbreak targets:\n”;
ii=Highest(NULL,0,MODE_HIGH,L2,0);
LC1=High[ii]-(Low[L2]+kL*(L2-ii));
LC2=Close[ii]-(Low[L2]+kL*(L2-ii));
ii=Highest(NULL,0,MODE_CLOSE,L2,0);
LC3=Close[ii]-(Low[L2]+kL*(L2-ii));
St=TrendLineStyle;/*Original STYLE_DASHDOT*/
}
ObjectSet(”LL_”+Step,OBJPROP_STYLE,St);
Comm=Comm+”T1=”+DoubleToStr(k-LC1,j)+” (”+DoubleToStr(LC1/Point,0)+”pts.)\n”;//changed “pts.)” to “pts.)\n”
//Comm=Comm+” T2=”+DoubleToStr(k-LC2,j)+” (”+DoubleToStr(LC2/Point,0)+”pts.)”;
//Comm=Comm+” T3=”+DoubleToStr(k-LC3,j)+” (”+DoubleToStr(LC3/Point,0)+”pts.)\n”;
ObjectSet(”LC1_”+Step,OBJPROP_TIME1,Time[L1]);ObjectSet(”LC1_”+Step,OBJPROP_TIME2,Time[0]);
ObjectSet(”LC1_”+Step,OBJPROP_PRICE1,k-LC1);ObjectSet(”LC1_”+Step,OBJPROP_PRICE2,k-LC1);
ObjectSet(”LC1_”+Step,OBJPROP_COLOR,Col);ObjectSet(”LC1_”+Step,OBJPROP_STYLE,St);
//ObjectSet(”LC2_”+Step,OBJPROP_TIME1,Time[L1]);ObjectSet(”LC2_”+Step,OBJPROP_TIME2,Time[0]);
//ObjectSet(”LC2_”+Step,OBJPROP_PRICE1,k-LC2);ObjectSet(”LC2_”+Step,OBJPROP_PRICE2,k-LC2);
//ObjectSet(”LC2_”+Step,OBJPROP_COLOR,Col);ObjectSet(”LC2_”+Step,OBJPROP_STYLE,St);
//ObjectSet(”LC3_”+Step,OBJPROP_TIME1,Time[L1]);ObjectSet(”LC3_”+Step,OBJPROP_TIME2,Time[0]);
//ObjectSet(”LC3_”+Step,OBJPROP_PRICE1,k-LC3);ObjectSet(”LC3_”+Step,OBJPROP_PRICE2,k-LC3);
//ObjectSet(”LC3_”+Step,OBJPROP_COLOR,Col);ObjectSet(”LC3_”+Step,OBJPROP_STYLE,St);
if (Step==1)
{
ObjectSet(”LC1_”+Step,OBJPROP_WIDTH,ProjectionLinesWidth);/*Original OBJPROP_WIDTH,2*/
ObjectSet(”LC1_”+Step,OBJPROP_STYLE,ProjectionLinesStyle);/*This Line of code added from original. TD Lower Projection Line Style*/
//ObjectSet(”LC2_”+Step,OBJPROP_WIDTH,2);
//ObjectSet(”LC3_”+Step,OBJPROP_WIDTH,2);
}
else
{
ObjectSet(”LC1_”+Step,OBJPROP_WIDTH,2);
//ObjectSet(”LC2_”+Step,OBJPROP_WIDTH,2);
//ObjectSet(”LC3_”+Step,OBJPROP_WIDTH,2);
}
return(Comm);
}
//——————————————————————–
string TDMain(int Step)
{
int H1,H2,L1,L2;
string Comm=”— step “+Step+” ——————–\n”;
int i,j; while (NormalizeDouble(Point,j)==0)j++;
double Style;
double Col[20];Col[0]=UpperProjectionLineColour/*Original Col[0]=Red, Colour for Current Upper TD Projection*/;Col[2]=Magenta;Col[4]=Chocolate;Col[6]=Goldenrod;Col[8]=SlateBlue;
Col[1]=LowerProjectionLineColour/*Original Col[1]=Blue, Colour for Current Lower TD Projection*/;Col[3]=FireBrick;Col[5]=Green;Col[7]=MediumOrchid;Col[9]=CornflowerBlue;
Col[10]=Red;Col[12]=Magenta;Col[14]=Chocolate;Col[16]=Goldenrod;Col[18]=SlateBlue;
Col[11]=Blue;Col[13]=FireBrick;Col[15]=Green;Col[17]=MediumOrchid;Col[19]=CornflowerBlue;
Step=Step+BackSteps;
H1=GetHighTD(Step);
H2=GetNextHighTD(H1);
L1=GetLowTD(Step);
L2=GetNextLowTD(L1);
TrendLineBreakUp=High[H2]-(High[H2]-High[H1])/(H2-H1)*H2;//added line
TrendLineBreakDown=Low[L2]+(Low[L1]-Low[L2])/(L2-L1)*L2;//added line
if (H1<0)Comm=Comm+"UTD no TD up-point \n";
else
if (H2%%14%%0 && L2>0)
{
if (TrendLine==1)
{
ObjectCreate(”LL_”+Step,OBJ_TREND,0,0,0,0,0);
TrendLineLowTD(L1,L2,Step,Col[Step*2-1]);
}
else ObjectDelete(”LL_”+Step);
if (HorizontLine==1 && Step==1)
{
ObjectCreate(”HLL_”+Step,OBJ_HLINE,0,0,0,0,0);
ObjectSet(”HLL_”+Step,OBJPROP_BACK,True);//Line added
HorizontLineLowTD(L1,L2,Step,Style,Col[Step*2-1]);
}
else ObjectDelete(”HLL_”+Step);
if (ProjectionLines==1)
{
ObjectCreate(”LC1_”+Step,OBJ_TREND,0,0,0,0,0);
ObjectCreate(”LC2_”+Step,OBJ_TREND,0,0,0,0,0);
ObjectCreate(”LC3_”+Step,OBJ_TREND,0,0,0,0,0);
Comm=Comm+TakeProfitLowTD(L1,L2,Step,Col[Step*2-1]);
}
else
{
ObjectDelete(”LC1_”+Step);
ObjectDelete(”LC2_”+Step);
ObjectDelete(”LC3_”+Step);
}
}
//——————————————————————–
if(AlertsOn)//added this Alerts section
{
//Print(”Alerts On”);

if(Close[0]>TrendLineBreakUp && TrendLineBreakUpFlag==False)
{
//Print(”Upper TrendLine Break “,Symbol(),” “,Period(),” “,Bid);
Alert(”UTL Break>”,TrendLineBreakUp,” on “,Symbol(),” “,Period(),” @ “,Bid);
TrendLineBreakUpFlag=True;
}
if(Close[0]
{
//Print("Lower Trendline Break ",Symbol()," ",Period()," ",Bid);
Alert("LTL Break<",TrendLineBreakDown," on ",Symbol()," ",Period()," @ ",Bid);
TrendLineBreakDownFlag=True;
}
//--------------------------------------------------------------------
}
return(Comm);
}
//--------------------------------------------------------------------
int start()
{
string Comm="";
SetTDPoint(Bars-1);
if (TD==1)
{
SetIndexArrow(0,217);
SetIndexArrow(1,218);
}
else
{
SetIndexArrow(0,160);
SetIndexArrow(1,160);
}
if (ShowingSteps>10)
{
Comment(”ShowingSteps readings 0 - 10″);
return(0);
}
for (int i=1;i<=ShowingSteps;i++)Comm=Comm+TDMain(i);
Comm=Comm+”————————————\nShowingSteps=”+ShowingSteps+”\nBackSteps=”+BackSteps;
if (FractalAsTD==true)Comm=Comm+”\nFractals”;
else Comm=Comm+”\nTD point”;
if (Comments==1)Comment(Comm);
else Comment(”");
return(0);
}

//+——————————————————————+

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

#MTF_Supertrend_On_Price

//+——————————————————————+
//| #MTF_Supertrend_On_Price.mq4 |
//| #MTF_Supertrend.mq4 |
//+——————————————————————+

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LimeGreen
#property indicator_color2 Red
#property indicator_minimum 0
#property indicator_maximum 0.5

//—- input parameters
/*************************************************************************
PERIOD_M1 1
PERIOD_M5 5
PERIOD_M15 15
PERIOD_M30 30
PERIOD_H1 60
PERIOD_H4 240
PERIOD_D1 1440
PERIOD_W1 10080
PERIOD_MN1 43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame’ value with the indicator inputs.
—————————————*/

extern int TimeFrame=0;

double ExtMapBuffer1[];
double ExtMapBuffer2[];

//+——————————————————————+
//| Custom indicator initialization function |
//+——————————————————————+

int init()
{

//—- indicator line

SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
SetIndexBuffer(1,ExtMapBuffer2);

//—- name for DataWindow and indicator subwindow label

switch(TimeFrame)
{
case 1 : string TimeFrameStr=”Period_M1″; break;
case 5 : TimeFrameStr=”Period_M5″; break;
case 15 : TimeFrameStr=”Period_M15″; break;
case 30 : TimeFrameStr=”Period_M30″; break;
case 60 : TimeFrameStr=”Period_H1″; break;
case 240 : TimeFrameStr=”Period_H4″; break;
case 1440 : TimeFrameStr=”Period_D1″; break;
case 10080 : TimeFrameStr=”Period_W1″; break;
case 43200 : TimeFrameStr=”Period_MN1″; break;
default : TimeFrameStr=”Current Timeframe”;
}
IndicatorShortName(”MTF_Supertrend(”+TimeFrameStr+”)”);

}

//—-

return(0);

//+——————————————————————+
//| MTF Supertrend |
//+——————————————————————+

int start()
{

datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted();

// Plot defined time frame on to current time frame

ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);

limit= Bars-counted_bars;
for(i=0,y=0;i {
if (Time[i]

/***********************************************************
Add your main indicator loop below. You can reference an existing
indicator with its iName or iCustom.
Rule 1: Add extern inputs above for all neccesary values
Rule 2: Use ‘TimeFrame’ for the indicator time frame
Rule 3: Use ‘y’ for your indicator’s shift value
**********************************************************/

ExtMapBuffer1[i]=iCustom(Symbol(),TimeFrame,”Supertrend”,0,y);
ExtMapBuffer2[i]=iCustom(Symbol(),TimeFrame,”Supertrend”,1,y);

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

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

#MTF_Supertrend

//+——————————————————————+
//| #MTF_Supertrend.mq4 |
//+——————————————————————+

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 LimeGreen
#property indicator_color2 Red
#property indicator_minimum 0
#property indicator_maximum 0.5

//—- input parameters
/*************************************************************************
PERIOD_M1 1
PERIOD_M5 5
PERIOD_M15 15
PERIOD_M30 30
PERIOD_H1 60
PERIOD_H4 240
PERIOD_D1 1440
PERIOD_W1 10080
PERIOD_MN1 43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame’ value with the indicator inputs.
—————————————*/

extern int TimeFrame=0;

double ExtMapBuffer1[];
double ExtMapBuffer2[];

//+——————————————————————+
//| Custom indicator initialization function |
//+——————————————————————+

int init()
{

//—- indicator line

SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(1,ExtMapBuffer2);

//—- name for DataWindow and indicator subwindow label

switch(TimeFrame)
{
case 1 : string TimeFrameStr=”Period_M1″; break;
case 5 : TimeFrameStr=”Period_M5″; break;
case 15 : TimeFrameStr=”Period_M15″; break;
case 30 : TimeFrameStr=”Period_M30″; break;
case 60 : TimeFrameStr=”Period_H1″; break;
case 240 : TimeFrameStr=”Period_H4″; break;
case 1440 : TimeFrameStr=”Period_D1″; break;
case 10080 : TimeFrameStr=”Period_W1″; break;
case 43200 : TimeFrameStr=”Period_MN1″; break;
default : TimeFrameStr=”Current Timeframe”;
}
IndicatorShortName(”MTF_Supertrend(”+TimeFrameStr+”)”);

}

//—-

return(0);

//+——————————————————————+
//| MTF Supertrend |
//+——————————————————————+

int start()
{

datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted();

// Plot defined time frame on to current time frame

ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);

limit= Bars-counted_bars;
for(i=0,y=0;i {
if (Time[i]

/***********************************************************
Add your main indicator loop below. You can reference an existing
indicator with its iName or iCustom.
Rule 1: Add extern inputs above for all neccesary values
Rule 2: Use ‘TimeFrame’ for the indicator time frame
Rule 3: Use ‘y’ for your indicator’s shift value
**********************************************************/

ExtMapBuffer1[i]=iCustom(Symbol(),TimeFrame,”Supertrend”,0,y);
ExtMapBuffer2[i]=iCustom(Symbol(),TimeFrame,”Supertrend”,1,y);

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

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

#MTF Candles

//+——————————————————————+
//| #MTF Candles.mq4 |
//| Copyright © 2006, Eli Hayun |
//| http://www.elihayun.com |
//+——————————————————————+
#property copyright “Copyright © 2006, Eli Hayun”
#property link “http://www.elihayun.com”

#property indicator_chart_window
//—- input parameters
extern int CandlesTF=240;
extern color UpCandleColor = LightBlue;
extern color DownCandleColor = Red;
//+——————————————————————+
//| Custom indicator initialization function |
//+——————————————————————+
int init()
{
//—- indicators
//—-
return(0);
}
//+——————————————————————+
//| Custom indicator deinitialization function |
//+——————————————————————+
int deinit()
{
//—-

//—-
return(0);
}
//+——————————————————————+
//| Custom indicator iteration function |
//+——————————————————————+
int start()
{
int counted_bars=IndicatorCounted();
//—-
double dif = MathAbs(Time[1] - Time[2]);

int ix = 0;
datetime dtStart = dif * 8 + Time[0];
for (int ii=0; ii<8; ii+=2)
{
ObjectDelete(”rect”+ii); ObjectDelete(”OTrnd”+ii); ObjectDelete(”CTrnd”+ii);
ObjectCreate(”rect”+ii,OBJ_TREND, 0, dtStart, iLow(NULL, CandlesTF,ix), dtStart, iHigh(NULL,CandlesTF,ix));
color clr = DownCandleColor; if (iOpen(NULL, CandlesTF,ix) < iClose(NULL, CandlesTF,ix)) clr = UpCandleColor;
ObjectSet(”rect”+ii, OBJPROP_COLOR, clr);
ObjectSet(”rect”+ii, OBJPROP_WIDTH, 3);

ObjectSet(”rect”+ii, OBJPROP_RAY, False);

ObjectCreate(”OTrnd”+ii, OBJ_TREND, 0, dtStart, iOpen(NULL, CandlesTF,ix), dtStart-dif, iOpen(NULL,CandlesTF,ix));
ObjectSet(”OTrnd”+ii, OBJPROP_WIDTH, 2);
ObjectSet(”OTrnd”+ii, OBJPROP_RAY, False);

ObjectSet(”CTrnd”+ii, OBJPROP_WIDTH, 2);
ObjectCreate(”CTrnd”+ii, OBJ_TREND, 0, dtStart, iClose(NULL, CandlesTF,ix), dtStart+dif, iClose(NULL,CandlesTF,ix));
ObjectSet(”CTrnd”+ii, OBJPROP_WIDTH, 2);
ObjectSet(”CTrnd”+ii, OBJPROP_RAY, False);

dtStart -= dif * 2;
ix++;
}

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

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

MA-Crossover_Alert

//+——————————————————————+
//| MA-Crossover_Alert.mq4 |
//| Copyright © 2005, Jason Robinson (jnrtrading) |
//| http://www.jnrtading.co.uk |
//| Modified by Robert Hill to add LSMA and alert or send email |
//| Added Global LastAlert to try to have alert only on new cross |
//| but does not seem to work. So indicator does alert every bar |
//+——————————————————————+

/*
+——————————————————————+
| Allows you to enter two ma periods and it will then show you at |
| Which point they crossed over. It is more usful on the shorter |
| periods that get obscured by the bars / candlesticks and when |
| the zoom level is out. Also allows you then to remove the mas |
| from the chart. (emas are initially set at 5 and 6) |
+——————————————————————+
*/
#property copyright “Copyright © 2005, Jason Robinson (jnrtrading)”
#property link “http://www.jnrtrading.co.uk”

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LawnGreen
#property indicator_color2 Red

extern bool SoundON=true;
extern bool EmailON=false;

extern int FastMA_Mode = 3; //0=sma, 1=ema, 2=smma, 3=lwma, 4=lsma
extern int FastMA_Period = 3;
extern int FastPriceMode = 6;//0=close, 1=open, 2=high, 3=low, 4=median(high+low)/2, 5=typical(high+low+close)/3, 6=weighted(high+low+close+close)/4
extern int SlowMA_Mode = 3; //0=sma, 1=ema, 2=smma, 3=lwma, 4=lsma
extern int SlowMA_Period = 34;
extern int SlowPriceMode = 6;//0=close, 1=open, 2=high, 3=low, 4=median(high+low)/2, 5=typical(high+low+close)/3, 6=weighted(high+low+close+close)/4
double CrossUp[];
double CrossDown[];
int flagval1 = 0;
int flagval2 = 0;
//+——————————————————————+
//| Custom indicator initialization function |
//+——————————————————————+
int init()
{
//—- indicators
SetIndexStyle(0, DRAW_ARROW, EMPTY, 3);
SetIndexArrow(0, 233);
SetIndexBuffer(0, CrossUp);
SetIndexStyle(1, DRAW_ARROW, EMPTY, 3);
SetIndexArrow(1, 234);
SetIndexBuffer(1, CrossDown);
GlobalVariableSet(”AlertTime”+Symbol()+Period(),CurTime());
GlobalVariableSet(”SignalType”+Symbol()+Period(),OP_SELLSTOP);
// GlobalVariableSet(”LastAlert”+Symbol()+Period(),0);
//—-
return(0);
}
//+——————————————————————+
//| Custom indicator deinitialization function |
//+——————————————————————+
int deinit()
{
//—-
GlobalVariableDel(”AlertTime”+Symbol()+Period());
GlobalVariableDel(”SignalType”+Symbol()+Period());
// GlobalVariableDel(”LastAlert”+Symbol()+Period());

//—-
return(0);
}

//+——————————————————————+
//| LSMA with PriceMode |
//| PrMode 0=close, 1=open, 2=high, 3=low, 4=median(high+low)/2, |
//| 5=typical(high+low+close)/3, 6=weighted(high+low+close+close)/4 |
//+——————————————————————+

double LSMA(int Rperiod, int prMode, int shift)
{
int i;
double sum, pr;
int length;
double lengthvar;
double tmp;
double wt;

length = Rperiod;

sum = 0;
for(i = length; i >= 1 ; i–)
{
lengthvar = length + 1;
lengthvar /= 3;
tmp = 0;
switch (prMode)
{
case 0: pr = Close[length-i+shift];break;
case 1: pr = Open[length-i+shift];break;
case 2: pr = High[length-i+shift];break;
case 3: pr = Low[length-i+shift];break;
case 4: pr = (High[length-i+shift] + Low[length-i+shift])/2;break;
case 5: pr = (High[length-i+shift] + Low[length-i+shift] + Close[length-i+shift])/3;break;
case 6: pr = (High[length-i+shift] + Low[length-i+shift] + Close[length-i+shift] + Close[length-i+shift])/4;break;
}
tmp = ( i - lengthvar)*pr;
sum+=tmp;
}
wt = sum*6/(length*(length+1));

return(wt);
}

//+——————————————————————+
//| Custom indicator iteration function |
//+——————————————————————+
int start() {
int limit, i, counter;
double tmp=0;
double fastMAnow, slowMAnow, fastMAprevious, slowMAprevious;
double Range, AvgRange;
int counted_bars=IndicatorCounted();
//—- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars–;

limit=Bars-counted_bars;

for(i = 0; i <= limit; i++) {

counter=i;
Range=0;
AvgRange=0;
for (counter=i ;counter<=i+9;counter++)
{
AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
}
Range=AvgRange/10;

if (FastMA_Mode == 4)
{
fastMAnow = LSMA(FastMA_Period, FastPriceMode, i);
fastMAprevious = LSMA(FastMA_Period, FastPriceMode, i+1);

}
else
{
fastMAnow = iMA(NULL, 0, FastMA_Period, 0, FastMA_Mode, FastPriceMode, i);
fastMAprevious = iMA(NULL, 0, FastMA_Period, 0, FastMA_Mode, FastPriceMode, i+1);
}

if (SlowMA_Mode == 4)
{
slowMAnow = LSMA( SlowMA_Period, SlowPriceMode, i);
slowMAprevious = LSMA( SlowMA_Period, SlowPriceMode, i+1);
}
else
{
slowMAnow = iMA(NULL, 0, SlowMA_Period, 0, SlowMA_Mode, SlowPriceMode, i);
slowMAprevious = iMA(NULL, 0, SlowMA_Period, 0, SlowMA_Mode, SlowPriceMode, i+1);
}

if ((fastMAnow > slowMAnow) && (fastMAprevious < slowMAprevious))
{
if (i == 1 && flagval1==0){ flagval1=1; flagval2=0; }
CrossUp[i] = Low[i] - Range*0.75;
}
else if ((fastMAnow < slowMAnow) && (fastMAprevious > slowMAprevious))
{
if (i == 1 && flagval2==0) { flagval2=1; flagval1=0; }
CrossDown[i] = High[i] + Range*0.75;
}
}

if (flagval1==1 && CurTime() > GlobalVariableGet(”AlertTime”+Symbol()+Period()) && GlobalVariableGet(”SignalType”+Symbol()+Period())!=OP_BUY)
{
// if (GlobalVariableGet(”LastAlert”+Symbol()+Period()) < 0.5)
// {
if (SoundON) Alert("BUY signal at Ask=",Ask,"\n Bid=",Bid,"\n Time=",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime()),"\n Symbol=",Symbol()," Period=",Period());
if (EmailON) SendMail("BUY signal alert","BUY signal at Ask="+DoubleToStr(Ask,4)+", Bid="+DoubleToStr(Bid,4)+", Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime())+" Symbol="+Symbol()+" Period="+Period());
// }
tmp = CurTime() + (Period()-MathMod(Minute(),Period()))*60;
GlobalVariableSet("AlertTime"+Symbol()+Period(),tmp);
GlobalVariableSet("SignalType"+Symbol()+Period(),OP_SELL);
// GlobalVariableSet("LastAlert"+Symbol()+Period(),1);
}

if (flagval2==1 && CurTime() > GlobalVariableGet(”AlertTime”+Symbol()+Period()) && GlobalVariableGet(”SignalType”+Symbol()+Period())!=OP_SELL) {
// if (GlobalVariableGet(”LastAlert”+Symbol()+Period()) > -0.5)
// {
if (SoundON) Alert(”SELL signal at Ask=”,Ask,”\n Bid=”,Bid,”\n Date=”,TimeToStr(CurTime(),TIME_DATE),” “,TimeHour(CurTime()),”:”,TimeMinute(CurTime()),”\n Symbol=”,Symbol(),” Period=”,Period());
if (EmailON) SendMail(”SELL signal alert”,”SELL signal at Ask=”+DoubleToStr(Ask,4)+”, Bid=”+DoubleToStr(Bid,4)+”, Date=”+TimeToStr(CurTime(),TIME_DATE)+” “+TimeHour(CurTime())+”:”+TimeMinute(CurTime())+” Symbol=”+Symbol()+” Period=”+Period());
// }
tmp = CurTime() + (Period()-MathMod(Minute(),Period()))*60;
GlobalVariableSet(”AlertTime”+Symbol()+Period(),tmp);
GlobalVariableSet(”SignalType”+Symbol()+Period(),OP_BUY);
// GlobalVariableSet(”LastAlert”+Symbol()+Period(),-1);
}

return(0);
}

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

_i_EF_distance

//+——————————————————————+
//| _i_EF_distance.mq4 |
//| Copyright © 2006, Doji Starr |
//| |
//+——————————————————————+
#property copyright “Copyright © 2006, Doji Starr”

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Aqua

// input params
extern int Length = 10;
extern double Power = 2;

// vars
int i, c, startBar;
double coef, norm;

// buffers
double buf_el[], buf_co[];

//+——————————————————————+
//| Custom indicator initialization function |
//+——————————————————————+
int init()
{
IndicatorBuffers(2);
SetIndexBuffer(0,buf_el);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(1,buf_co);

return(0);
}

//+——————————————————————+
//| Custom indicator deinitialization function |
//+——————————————————————+
int deinit()
{
return(0);
}

//+——————————————————————+
//| Custom indicator iteration function |
//+——————————————————————+
int start()
{
if (Bars <= Length)
return(0);

int bar;
int counted_bars = IndicatorCounted();

if (counted_bars < 1)
{
// filling initial values in buffers
for (bar=Bars-1; bar>=Bars-Length*2; bar–)
{
buf_el[bar] = Close[bar];
buf_co[bar] = 0.0;
}
startBar = Bars-Length*2-1;
}
else
startBar = Bars-counted_bars-1;

for (bar=startBar; bar>=0; bar–)
{
buf_co[bar] = 0.0;
for (i=Length-1; i>=0; i–)
buf_co[bar] += MathAbs(MathPow(Close[bar]-Close[bar+i], Power));

norm = 0.0;
buf_el[bar] = 0.0;
for (i=Length-1; i>=0; i–)
{
norm += buf_co[bar+i];
buf_el[bar] += buf_co[bar+i] * Close[bar+i];
}
if (norm != 0)
buf_el[bar] /= norm;
else
buf_el[bar] = 0.0;
//Print(norm);
}

return(0);
}

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

^Pivot_ResSup

//+——————————————————————+
//| ^Pivot_ResSup.mq4 |
//| Modest, Rosh conversed only |
//| http://forexsystems.ru/phpBB/index.php |
//+——————————————————————+
#property copyright “Modest, Rosh conversed only”
#property link “http://forexsystems.ru/phpBB/index.php”
//// Ñòðîèì Pivot è Res/Supp ïî FibonacciTrader Journal Issue 6
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LightBlue
#property indicator_color2 Magenta
//—- input parameters
extern int Formula=0;
int i=1, shift;
double FP=0.0;
double FH=0.0, FL=0.0;
bool result;
//—- buffers
double ExtMapBuffer1[];
double ResBuffer[];
double SupBuffer[];

//+——————————————————————+
//| Ïðîâåðêà íîâîãî äíÿ |
//+——————————————————————+
bool isNewDay(int _shift)
{
//—-
result=false;
if ( (TimeHour(Time[_shift])==0) && (TimeMinute(Time[_shift])==0) ) result=true;

//—-
return(result);
}
//+——————————————————————+
//| Ïîëó÷èòü óðîâíè FP,Res1 è Sup1 ïðîøåäøåãî äíÿ |
//+——————————————————————+
void GetRS2ofDay(int _shift)
{
int prevDay=TimeDay(Time[_shift+1]);
//—-
i=1;
while (TimeDay(Time[_shift+i])==prevDay) i++;
i–;
FH=High[Highest(NULL,0,MODE_HIGH,i,_shift+1)];
FL=Low[Lowest(NULL,0,MODE_LOW,i,_shift+1)];
if (Formula==0) FP=NormalizeDouble((FH+FL+Close[_shift+1])/3.0,Digits); else FP=NormalizeDouble((FH+FL+2*Close[_shift+1])/4.0,Digits);
ResBuffer[_shift]=NormalizeDouble(FP+(FH-FL),Digits);
SupBuffer[_shift]=NormalizeDouble(FP-(FH-FL),Digits);
//—-
}

//+——————————————————————+
//| Êîïèðîâàòü FP,Res1 è Sup1 ïðîøåäøåãî äíÿ |
//+——————————————————————+
void CopyLevels2Day(int _shift)
{
ExtMapBuffer1[_shift]=ExtMapBuffer1[_shift];
ResBuffer[_shift]=ResBuffer[_shift+1];
SupBuffer[_shift]=SupBuffer[_shift+1];
}

//+——————————————————————+
//| Custom indicator initialization function |
//+——————————————————————+
int init()
{
if (Formula!=0)Formula=1;
string label1=”Pivot_Res2(”+Formula+”)”;
string label2=”Pivot_Sup2(”+Formula+”)”;
//—- indicators
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,160);
SetIndexBuffer(0,ResBuffer);
SetIndexEmptyValue(0,0.0);
SetIndexLabel(0,label2);

SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,160);
SetIndexBuffer(1,SupBuffer);
SetIndexEmptyValue(1,0.0);
SetIndexLabel(1,label2);

SetIndexBuffer(0,ExtMapBuffer1);
//—-
return(0);
}
//+——————————————————————+
//| Custor indicator deinitialization function |
//+——————————————————————+
int deinit()
{
//—-

//—-
return(0);
}
//+——————————————————————+
//| Custom indicator iteration function |
//+——————————————————————+
int start()
{
int limit,firstDay;
int counted_bars=IndicatorCounted();
if (counted_bars<0) return(0);
if (counted_bars==0)
{
limit=Bars-1;
i=1;
firstDay=TimeDay(Time[limit]);
while (TimeDay(Time[limit-i])==firstDay) i++;
limit=limit-i-PERIOD_D1/Period();
}
if (counted_bars>0) limit=Bars-counted_bars;
//—-
if (Period()>PERIOD_H4) return;
for (shift=limit;shift>=0;shift–)
{
if (isNewDay(shift)) GetRS2ofDay(shift); else CopyLevels2Day(shift);
}
//—-
return(0);
}
//+——————————————————————+

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

^Pivot_ResSup

//+——————————————————————+
//| ^Pivot_ResSup.mq4 |
//| Modest, Rosh conversed only |
//| http://forexsystems.ru/phpBB/index.php |
//+——————————————————————+
#property copyright “Modest, Rosh conversed only”
#property link “http://forexsystems.ru/phpBB/index.php”
//// Ñòðîèì Pivot è Res/Supp ïî FibonacciTrader Journal Issue 6
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//—- input parameters
extern int Formula=0;
int i=1, shift;
double FP=0.0;
double FH=0.0, FL=0.0;
bool result;
//—- buffers
double ExtMapBuffer1[];
double ResBuffer[];
double SupBuffer[];

//+——————————————————————+
//| Ïðîâåðêà íîâîãî äíÿ |
//+——————————————————————+
bool isNewDay(int _shift)
{
//—-
result=false;
if ( (TimeHour(Time[_shift])==0) && (TimeMinute(Time[_shift])==0) ) result=true;

//—-
return(result);
}
//+——————————————————————+
//| Ïîëó÷èòü óðîâíè FP,Res1 è Sup1 ïðîøåäøåãî äíÿ |
//+——————————————————————+
void GetRS1ofDay(int _shift)
{
int prevDay=TimeDay(Time[_shift+1]);
//—-
i=1;
while (TimeDay(Time[_shift+i])==prevDay) i++;
i–;
FH=High[Highest(NULL,0,MODE_HIGH,i,_shift+1)];
FL=Low[Lowest(NULL,0,MODE_LOW,i,_shift+1)];
if (Formula==0) FP=NormalizeDouble((FH+FL+Close[_shift+1])/3.0,Digits); else FP=NormalizeDouble((FH+FL+2*Close[_shift+1])/4.0,Digits);
ResBuffer[_shift]=NormalizeDouble(FP+(FP-FL),Digits);
SupBuffer[_shift]=NormalizeDouble(FP-(FH-FP),Digits);
//—-
}

//+——————————————————————+
//| Êîïèðîâàòü FP,Res1 è Sup1 ïðîøåäøåãî äíÿ |
//+——————————————————————+
void CopyLevels1Day(int _shift)
{
ExtMapBuffer1[_shift]=ExtMapBuffer1[_shift];
ResBuffer[_shift]=ResBuffer[_shift+1];
SupBuffer[_shift]=SupBuffer[_shift+1];
}

//+——————————————————————+
//| Custom indicator initialization function |
//+——————————————————————+
int init()
{
if (Formula!=0)Formula=1;
string label1=”Pivot_Res(”+Formula+”)”;
string label2=”Pivot_Sup(”+Formula+”)”;
//—- indicators
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,160);
SetIndexBuffer(0,ResBuffer);
SetIndexEmptyValue(0,0.0);
SetIndexLabel(0,label2);

SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,160);
SetIndexBuffer(1,SupBuffer);
SetIndexEmptyValue(1,0.0);
SetIndexLabel(1,label2);

SetIndexBuffer(0,ExtMapBuffer1);
//—-
return(0);
}
//+——————————————————————+
//| Custor indicator deinitialization function |
//+——————————————————————+
int deinit()
{
//—-

//—-
return(0);
}
//+——————————————————————+
//| Custom indicator iteration function |
//+——————————————————————+
int start()
{
int limit,firstDay;
int counted_bars=IndicatorCounted();
if (counted_bars<0) return(0);
if (counted_bars==0)
{
limit=Bars-1;
i=1;
firstDay=TimeDay(Time[limit]);
while (TimeDay(Time[limit-i])==firstDay) i++;
limit=limit-i-PERIOD_D1/Period();
}
if (counted_bars>0) limit=Bars-counted_bars;
//—-
if (Period()>PERIOD_H4) return;
for (shift=limit;shift>=0;shift–)
{
if (isNewDay(shift)) GetRS1ofDay(shift); else CopyLevels1Day(shift);
}
//—-
return(0);
}
//+——————————————————————+

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

^Pivot_PP

//+——————————————————————+
//| ^Pivot_PP.mq4 |
//| Modest, Rosh conversed only |
//| http://forexsystems.ru/phpBB/index.php |
//+——————————————————————+
#property copyright “Modest, Rosh conversed only”
#property link “http://forexsystems.ru/phpBB/index.php”
//// Ñòðîèì Pivot è Res/Supp ïî FibonacciTrader Journal Issue 6
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 DarkGreen
//—- input parameters
extern int Formula=0;
int i=1, shift;
double FP=0.0;
double FH=0.0, FL=0.0;
bool result;
//—- buffers
double ExtMapBuffer1[];

//+——————————————————————+
//| Ïðîâåðêà íîâîãî äíÿ |
//+——————————————————————+
bool isNewDay(int _shift)
{
//—-
result=false;
if ( (TimeHour(Time[_shift])==0) && (TimeMinute(Time[_shift])==0) ) result=true;

//—-
return(result);
}
//+——————————————————————+
//| Ïîëó÷èòü óðîâåíü FP ïðîøåäøåãî äíÿ |
//+——————————————————————+
double GetFPofDay(int _shift)
{
int prevDay=TimeDay(Time[_shift+1]);
//—-
i=1;
while (TimeDay(Time[_shift+i])==prevDay) i++;
i–;
FH=High[Highest(NULL,0,MODE_HIGH,i,_shift+1)];
FL=Low[Lowest(NULL,0,MODE_LOW,i,_shift+1)];
if (Formula==0) FP=NormalizeDouble((FH+FL+Close[_shift+1])/3.0,Digits); else FP=NormalizeDouble((FH+FL+2*Close[_shift+1])/4.0,Digits);
//—-
return(FP);
}
//+——————————————————————+
//| Custom indicator initialization function |
//+——————————————————————+
int init()
{
if (Formula!=0)Formula=1;
string label=”Pivot_PP(”+Formula+”)”;
//—- indicators
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,160);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexEmptyValue(0,0.0);
SetIndexLabel(0,label);

//—-
return(0);
}
//+——————————————————————+
//| Custor indicator deinitialization function |
//+——————————————————————+
int deinit()
{
//—-

//—-
return(0);
}
//+——————————————————————+
//| Custom indicator iteration function |
//+——————————————————————+
int start()
{
int limit,firstDay;
int counted_bars=IndicatorCounted();
if (counted_bars<0) return(0);
if (counted_bars==0)
{
limit=Bars-1;
i=1;
firstDay=TimeDay(Time[limit]);
while (TimeDay(Time[limit-i])==firstDay) i++;
limit=limit-i-PERIOD_D1/Period();
}
if (counted_bars>0) limit=Bars-counted_bars;
//—-
if (Period()>PERIOD_H4) return;
for (shift=limit;shift>=0;shift–)
{
if (isNewDay(shift)) ExtMapBuffer1[shift]=GetFPofDay(shift); else ExtMapBuffer1[shift]=ExtMapBuffer1[shift+1];
//if (shift==0) SetNullBarValue(shift);
}
//—-
return(0);
}
//+——————————————————————+

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

^Pivot_ResSup

//+——————————————————————+
//| ^Pivot_ResSup.mq4 |
//| Modest, Rosh conversed only |
//| http://forexsystems.ru/phpBB/index.php |
//+——————————————————————+
#property copyright “Modest, Rosh conversed only”
#property link “http://forexsystems.ru/phpBB/index.php”
//// Ñòðîèì Pivot è Res/Supp ïî FibonacciTrader Journal Issue 6
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 LightBlue
#property indicator_color2 Blue
#property indicator_color3 DarkGreen
#property indicator_color4 Red
#property indicator_color5 Magenta
//—- input parameters
extern int Formula=0;
int i=1, shift;
double FP=0.0;
double FH=0.0, FL=0.0;
bool result;
//—- buffers
double ResBuffer2[];
double ResBuffer[];
double ExtMapBuffer1[];
double SupBuffer[];
double SupBuffer2[];

//+——————————————————————+
//| Ïðîâåðêà íîâîãî äíÿ |
//+——————————————————————+
bool isNewDay(int _shift)
{
//—-
result=false;
if ( (TimeHour(Time[_shift])==0) && (TimeMinute(Time[_shift])==0) ) result=true;

//—-
return(result);
}
//+——————————————————————+
//| Ïîëó÷èòü óðîâíè FP,Res1,Sup1,Res2 è Sup2 ïðîøåäøåãî äíÿ |
//+——————————————————————+
void GetRSofDay(int _shift)
{
int prevDay=TimeDay(Time[_shift+1]);
//—-
i=1;
while (TimeDay(Time[_shift+i])==prevDay) i++;
i–;
FH=High[Highest(NULL,0,MODE_HIGH,i,_shift+1)];
FL=Low[Lowest(NULL,0,MODE_LOW,i,_shift+1)];
if (Formula==0) FP=NormalizeDouble((FH+FL+Close[_shift+1])/3.0,Digits); else FP=NormalizeDouble((FH+FL+2*Close[_shift+1])/4.0,Digits);
ExtMapBuffer1[_shift]=FP;
ResBuffer[_shift]=NormalizeDouble(FP+(FP-FL),Digits);
SupBuffer[_shift]=NormalizeDouble(FP-(FH-FP),Digits);
ResBuffer2[_shift]=NormalizeDouble(FP+(FH-FL),Digits);
SupBuffer2[_shift]=NormalizeDouble(FP-(FH-FL),Digits);
//—-
}

//+——————————————————————+
//| Êîïèðîâàòü FP,Res1,Sup1,Res2 è Sup2 ïðîøåäøåãî äíÿ |
//+——————————————————————+
void CopyLevelsDay(int _shift)
{
ExtMapBuffer1[_shift]=ExtMapBuffer1[_shift+1];
ResBuffer[_shift]=ResBuffer[_shift+1];
SupBuffer[_shift]=SupBuffer[_shift+1];
ResBuffer2[_shift]=ResBuffer2[_shift+1];
SupBuffer2[_shift]=SupBuffer2[_shift+1];
}

//+——————————————————————+
//| Custom indicator initialization function |
//+——————————————————————+
int init()
{
if (Formula!=0)Formula=1;
string label1=”Pivot_Res2(”+Formula+”)”;
string label2=”Pivot_Res(”+Formula+”)”;
string label3=”Pivot_Point(”+Formula+”)”;
string label4=”Pivot_Sup(”+Formula+”)”;
string label5=”Pivot_Sup2(”+Formula+”)”;
//—- indicators
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,160);
SetIndexBuffer(0,ResBuffer2);
SetIndexEmptyValue(0,0.0);
SetIndexLabel(0,label1);

SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,160);
SetIndexBuffer(1,ResBuffer);
SetIndexEmptyValue(1,0.0);
SetIndexLabel(1,label2);

SetIndexStyle(2,DRAW_ARROW);
SetIndexArrow(2,160);
SetIndexBuffer(2,ExtMapBuffer1);
SetIndexEmptyValue(2,0.0);
SetIndexLabel(2,label3);

SetIndexStyle(3,DRAW_ARROW);
SetIndexArrow(3,160);
SetIndexBuffer(3,SupBuffer);
SetIndexEmptyValue(3,0.0);
SetIndexLabel(3,label4);

SetIndexStyle(4,DRAW_ARROW);
SetIndexArrow(4,160);
SetIndexBuffer(4,SupBuffer2);
SetIndexEmptyValue(4,0.0);
SetIndexLabel(4,label5);

//—-
return(0);
}
//+——————————————————————+
//| Custor indicator deinitialization function |
//+——————————————————————+
int deinit()
{
//—-

//—-
return(0);
}
//+——————————————————————+
//| Custom indicator iteration function |
//+——————————————————————+
int start()
{
int limit,firstDay;
int counted_bars=IndicatorCounted();
if (counted_bars<0) return(0);
if (counted_bars==0)
{
limit=Bars-1;
i=1;
firstDay=TimeDay(Time[limit]);
while (TimeDay(Time[limit-i])==firstDay) i++;
limit=limit-i-PERIOD_D1/Period();
}
if (counted_bars>0) limit=Bars-counted_bars;
//—-
if (Period()>PERIOD_H4) return;
for (shift=limit;shift>=0;shift–)
{
if (isNewDay(shift)) GetRSofDay(shift); else CopyLevelsDay(shift);
}
//—-
return(0);
}
//+——————————————————————+

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

 Page 1 of 10  1  2  3  4  5 » ...  Last » 

Tweet This Post links powered by Tweet This v1.3.9, a WordPress plugin for Twitter.