Download Stochastic 3 – Advanced stochastic MT4 Indicator

Stochastic 3 – Advanced stochastic MT4 Indicator

Stochastic 3 – Advanced stochastic indicator calculates 3 different time frames to generate trading signals. The first time is the same as chart’s time frame. For example in the picture above; the first time frame calculated is 1H, other time frames are 4H and 1D. If you run the indicator on a 4H chart, then the time frames analyzed would be 4H, 1D and 1W.

How to Trade With Stochastic 3 – Advanced stochastic:

Buy Signal: Wait for the stochastic line to turn to green.

Sell Signal: Wait for the stochastic line to turn to red.

 

[php]

//+——————————————————————+
//| Stochastic3_v2.mq4 |
//| Copyright © 2009, Vladimir Hlystov |
//+——————————————————————+
#property copyright “Copyright © 2009, Vladimir Hlystov”
#property link “[email protected]
//+——————————————————————+
extern bool AlertON = false;
//+——————————————————————+
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_level1 20
#property indicator_level3 50
#property indicator_level2 80
#property indicator_levelcolor Silver
#property indicator_levelwidth 0
#property indicator_levelstyle 2
#property indicator_buffers 6
#property indicator_color1 Maroon
#property indicator_style1 2
#property indicator_color2 DarkGreen
#property indicator_style2 2
#property indicator_color3 Navy
#property indicator_style3 2
#property indicator_color4 Orange
#property indicator_width4 2
#property indicator_color5 Green
#property indicator_width5 2
#property indicator_color6 Red
#property indicator_width6 2
//—- buffers
double SignalBuffer[];
double BUFFER_1[];
double BUFFER_2[];
double BUFFER_3[];
double GREEN[];
double RED[];
int per1;
int per2;
int per3;
int n=3;
//+——————————————————————+
//| Custom indicator initialization function |
//+——————————————————————+
int init()
{
ObjectCreate(“on”, OBJ_LABEL, 1, 0, 0);// رîçنàيèه îلْ.
ObjectSet(“on”, OBJPROP_CORNER, 0);
ObjectSet(“on”, OBJPROP_XDISTANCE, 10);
ObjectSet(“on”, OBJPROP_YDISTANCE, 15);
if (AlertON)ObjectSetText(“on”,”Alert ON”,8,”Arial”,Blue);
else ObjectSetText(“on”,”Alert OFF”,8,”Arial”,Red);
//—- indicator lines
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0, BUFFER_1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1, BUFFER_2);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2, BUFFER_3);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3, SignalBuffer);
SetIndexStyle(4,DRAW_LINE);
SetIndexBuffer(4, GREEN);
SetIndexStyle(5,DRAW_LINE);
SetIndexBuffer(5, RED);
//—- name for DataWindow and indicator subwindow label
per1=Period();
per2 = next_period(per1+1);
if (per2==0) n=1;
per3 = next_period(per2+1);
if (per3==0&&per2!=0) n=2;
SetIndexLabel(0, string_ïهً(per1));
SetIndexLabel(1, string_ïهً(per2));
SetIndexLabel(2, string_ïهً(per3));
SetIndexLabel(3, “Average”);
IndicatorShortName(“Stochastic 3(“+string_ïهً(per1)+””+string_ïهً(per2)+””+string_ïهً(per3)+”)”);
return(0);
}
//+——————————————————————+
//| Stochastic oscillator |
//+——————————————————————+
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars>0) counted_bars–;
int limit=Bars-counted_bars;
for(int i=0; i<limit; i++)
{
BUFFER_1[i] = iStochastic(NULL,per1 ,5,3,3,MODE_SMA,0,MODE_MAIN,iBarShift(NULL,per1 ,Time[i],false));
if (n>1) BUFFER_2[i] = iStochastic(NULL,per2 ,5,3,3,MODE_SMA,0,MODE_MAIN,iBarShift(NULL,per2 ,Time[i],false));
if (n>2) BUFFER_3[i] = iStochastic(NULL,per3 ,5,3,3,MODE_SMA,0,MODE_MAIN,iBarShift(NULL,per3 ,Time[i],false));
if (n==3) SignalBuffer[i] = (BUFFER_1[i]+BUFFER_2[i]+BUFFER_3[i])/n;
if (n==2) SignalBuffer[i] = (BUFFER_1[i]+BUFFER_2[i])/n;
if (n==1) SignalBuffer[i] = BUFFER_1[i];
if (SignalBuffer[i]>80) {GREEN[i]=SignalBuffer[i];if (AlertON&&i<2) Alert(Symbol()+” Stochastic 3 = “+DoubleToStr(SignalBuffer[i],2));}
if (SignalBuffer[i]<20) {RED [i]=SignalBuffer[i];if (AlertON&&i<2) Alert(Symbol()+” Stochastic 3 = “+DoubleToStr(SignalBuffer[i],2));}

}
return(0);
}
//+——————————————————————+
int next_period(int per)
{
if (per > 43200) return(0);
if (per > 10080) return(43200);
if (per > 1440) return(10080);
if (per > 240) return(1440);
if (per > 60) return(240);
if (per > 30) return(60);
if (per > 15) return(30);
if (per > 5) return(15);
if (per > 1) return(5);
}
//+——————————————————————+
string string_ïهً(int per)
{
if (per == 1) return(” M1 “);
if (per == 5) return(” M5 “);
if (per == 15) return(” M15 “);
if (per == 30) return(” M30 “);
if (per == 60) return(” H1 “);
if (per == 240) return(” H4 “);
if (per == 1440) return(” D1 “);
if (per == 10080) return(” W1 “);
if (per == 43200) return(” MN1 “);
return(“îّèلêà ïهًèîنà”);
}
//+——————————————————————+
int deinit()
{
ObjectDelete(“on”);
}
//+——————————————————————+

&nbsp;

[/php]

Click Here to Download

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *