//+------------------------------------------------------------------+ //| Stochastic (with alert) | //| Copyright © 2009 darrenw | //+------------------------------------------------------------------+ #property copyright "Iremos Trading" #property link "Darren Willis" #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Black #property indicator_color2 Black #property indicator_minimum 0 #property indicator_maximum 100 extern string ________EXIT_______; extern int K = 6; extern int D = 3; extern int Slowing = 3; extern int MA_Mode = 0; // 0 = SMA, 1 = EMA, extern int Shift_Bars= 0; extern int Bars_Count= 0; extern string _________Alert________; extern double Overbuy_Level = 50.51; extern double Oversell_Level = 49.51; extern bool Enable_Alert_1 = true; extern double Crossover_Gap = 0; extern bool Enable_Alert_2 = false; //---- buffers double v1[]; double v2[]; int init() { IndicatorBuffers(2); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2); SetIndexDrawBegin(0,K+Slowing); SetIndexBuffer(0, v1); SetIndexLabel(0,"K"); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2); SetIndexDrawBegin(1,K+D+Slowing); SetIndexBuffer(1, v2); SetIndexLabel(1,"D"); watermark(); return(0); } int start() { int i; int shift; int counted_bars = IndicatorCounted(); if (counted_bars > 0) counted_bars--; if (Bars_Count > 0 && Bars_Count <= Bars) { i = Bars_Count - counted_bars; }else{ i = Bars - counted_bars; } while(i>=0) { shift = i + Shift_Bars; v1[i] = iStochastic(Symbol(), Period(), K, D, Slowing, MA_Mode, 0, 0, shift); v2[i] = iStochastic(Symbol(), Period(), K, D, Slowing, MA_Mode, 0, 1, shift); Print(v1[i]); i--; } // Alert: Overbuy and Oversold static int OBOS; if (Enable_Alert_1 && v1[0] >= Overbuy_Level && OBOS != 1) { OBOS = 1; Alert("Pay Attention! LONG SIGNAL Look at 4H Stoch K: ", v1[0]); }else if (Enable_Alert_1 && v1[0] <= Oversell_Level && OBOS != -1){ OBOS = -1; Alert("Pay Attention! SHORT SIGNAL Look at 4H Stoch K: ", v1[0]); } // Alert crossover static int Crossover; if (Enable_Alert_2 && v1[1] < v2[0] + Crossover_Gap && v1[0] >= v2[0] + Crossover_Gap && Crossover != 1) { Crossover = 1; Alert("K cross UP through D...Go LONG!!"); }else if(Enable_Alert_2 && v1[1] > v2[0] - Crossover_Gap && v1[0] <= v2[0] - Crossover_Gap && Crossover != -1) { Crossover = -1; Alert("K cross DOWN through D...Go SHORT!!"); } return(0); } //+------------------------------------------------------------------+ void watermark() { ObjectCreate("Iremos Trading", OBJ_LABEL, 0, 0, 0); ObjectSetText("Iremos Trading", "Iremos Trading © __Darren__", 10, "Engravers MT", Aqua); ObjectSet("Iremos Trading", OBJPROP_CORNER, 2); ObjectSet("Iremos Trading", OBJPROP_XDISTANCE, 5); ObjectSet("Iremos Trading", OBJPROP_YDISTANCE, 10); return(0); }
Sample
Analysis
Market Information Used:
Indicator Curves created:
Implements a curve of type DRAW_LINE
Indicators Used:
Stochastic oscillator
Custom Indicators Used:
Order Management characteristics:
Other Features:
It issuies visual alerts to the screen