Forex
Google
New signals service!

Go Back   Forex Trading > Discussion Areas > Setup Questions


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

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-11-2007, 07:50 PM
Member
 
Join Date: Mar 2007
Posts: 32
Nordic12 is on a distinguished road
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);
}
//+------------------------------------------------------------------+
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-11-2007, 09:12 PM
Senior Member
 
Join Date: Dec 2006
Location: Ukraine
Posts: 491
Shinigami is on a distinguished road
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 ^^
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-11-2007, 09:22 PM
Member
 
Join Date: Mar 2007
Posts: 32
Nordic12 is on a distinguished road
.

Im sorry I dont understand your reply Shinigami
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-18-2007, 03:19 AM
Senior Member
 
Join Date: Jan 2007
Location: not so remote
Posts: 2,242
fxbs is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
stoch, istochastic

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

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


All times are GMT. The time now is 05:10 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.