stoch indicator to ea..

 

hello every one..

i want to put indicator stoch to ea, but don't know how to get the value of 2 lines..

the stoch have 2 lines : red and blue line..

i am using code like this:

int start()

{

double stochh=iCustom(NULL,0,"Stochastic",2,1);

double stochl=iCustom(NULL,0,"Stochastic",3,1);

if(stochh>stochl)
{

OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Ask-StopLose*Point,Ask+TakeProfit*Point,"My order #1",16384,0,Green);

}

}


i am using custom indicator stoch, because want to get his value..

can i get value from normal stoch indicator that not custom?

but that coding is wrong.. it seems not get the lines value..

i want if blue line acrross down the red in this bar, so next bar will sell..

if blue acrross up the red, so buy in next bar..


so how about that code?

thx.,..

 

You forgot to pass parameters.

double stoch = iCustom( Symbol(), Period(), "Stochastic", KPeriod, DPeriod, Slowing, LINE_INDEX, BAR );

As I can tell Sto() line (blue by default) is LINE_INDEX = 0 and Signal line (red one by default) is LINE_INDEX = 1. You can check it in Data Window of your terminal.


Standart function for stoch is iStochastic -> https://docs.mql4.com/indicators/iStochastic

 

oh.. thx boss...

i don't think this is realy easy..

hehe..

ok, thx very much..