//+------------------------------------------------------------------+ //| Stochastic Slope.mq4 | //| Renato Granzoti | //| | //+------------------------------------------------------------------+ #property copyright "Renato Granzoti" #property link "" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Red //---- buffers double ExtMapBuffer1[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); string short_name = "Stochastic Signal Slope"; IndicatorShortName (short_name); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); if (counted_bars < 0) return (-1); if (counted_bars > 0) counted_bars--; int pos = Bars - counted_bars; double stoch0, stoch1, slope; while (pos >= 0) { stoch0 = iStochastic (NULL, 0, 8, 3, 5, MODE_SMA, 0, 1, pos); stoch1 = iStochastic (NULL, 0, 8, 3, 5, MODE_SMA, 0, 1, (pos+1)); slope = stoch0 - stoch1; ExtMapBuffer1[pos] = slope; pos--; } return(0); } //+------------------------------------------------------------------+