| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Stoch Cross over indicator not working
Hi
Trying to modify existing code from a macd to stoch cross over (so it shows once on main screen if the stoch crosss over and its over 20) but the code doesnt work Any help please ? #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red //---- input parameters extern int Stoch_K = 5; extern int Stoch_D = 3; extern int Stoch_Slowing = 2; extern bool UseAlert=false; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,233); SetIndexBuffer(0,ExtMapBuffer1); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,234); SetIndexBuffer(1,ExtMapBuffer2); SetIndexEmptyValue(1,0.0); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit; 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; //---- main loop for(int i=0; i<limit; i++) { ExtMapBuffer1[i] = 0; ExtMapBuffer2[i] = 0; double stochk0 = iStochastic(Symbol(), Period(), Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, i); double stochk2 = iStochastic(Symbol(), Period(), Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, i+1); double stochk10 = iStochastic(Symbol(), Period(), Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, i); double stochk12 = iStochastic(Symbol(), Period(), Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, i+1); if (stochk0 > stochk10 && stochk2 < stochk12) ExtMapBuffer1[i] = iLow(NULL, 0, i+1); if (stochk0 < stochk10 && stochk2 > stochk12) ExtMapBuffer2[i] = iHigh(NULL, 0, i+1); } return(0); } //+------------------------------------------------------------------+ |
|
|||
|
loooooooooooooooooooooooooooool
find a place on a chart when this condition is true if (stochk0 > stochk10) double stochk0 = iStochastic(Symbol(), Period(), Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, i); double stochk10 = iStochastic(Symbol(), Period(), Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, i); Or at least find me at least 2 differences! ![]()
__________________
MQL4 programming is easy ^^ |
|
|||
|
stochk0> stochk10 ?
iStochastic(Symbol(), Period(), Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, i)> iStochastic(Symbol(), Period(), Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, i)? ________ "(stochk0 > stochk10) double stochk0 = iStochastic(Symbol(), Period(), Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, i); double stochk10 = iStochastic(Symbol(), Period(), Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, i);" Last edited by fxbs; 08-18-2007 at 03:21 AM. |
![]() |
| Bookmarks |
| Tags |
| stoch, istochastic |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Working indicator not working | yuhu | Indicators - Metatrader 4 | 0 | 05-25-2007 02:38 AM |
| Stoch cross indicator | Den | Metatrader 4 | 0 | 04-27-2007 07:56 AM |
| Process the indicator value fi the RSI of a Stoch | niels | Metatrader 4 | 0 | 02-28-2007 11:05 AM |