question stochastic buffer

 

hello... iam using mt5 build478...

i have the following question, in the docs

https://www.mql5.com/en/docs/indicators/istochastic

is written for stochastic:

The buffer numbers: 0 - MAIN_LINE, 1 - SIGNAL_LINE

https://www.mql5.com/en/articles/130

is using buffer 1 and buffer 2, not buffer 0 and buffer 1?

Search for therm "TradeSignal_05":

//--- check the condition and set a value for sig
   if(stoh_buffer[2]<20 && stoh_buffer[1]>20)
      sig=1;
   else if(stoh_buffer[2]>80 && stoh_buffer[1]<80)
      sig=-1;
   else sig=0;


So i do a output:

stoh_buffer: [0]13.58695652173258|[1]32.9479768786027|[2]47.65624999998326

What a value is [2]???

And wich one is Main, wich is Signal, whats right?


-----------------------------------

Now i see another problem:


............

h_stoh   = iStochastic(Symbol(), Period(), 5, 3, 3, MODE_EMA, STO_CLOSECLOSE);
if(h_stoh==INVALID_HANDLE){
    Alert("Stochastic Handle Error!");
    return(0);
   } else  {
    if(CopyBuffer(h_stoh,0,0,3,stoh_buffer)<3) return(0);
    if(!ArraySetAsSeries(stoh_buffer,true)) return(0);
   }
  
//--- checking of the condition
 Print("stohbuffer: "+ stoh_buffer[0]+"|"+stoh_buffer[1]+"|"+stoh_buffer[2]);

output like above:

Stochbuffer: 91.11111111110778|72.83950617283128|83.33333333332911

Now i can see the stochastic because of adding it to chart:
ChartIndicatorAdd(0,1,h_stoh); // to see the values

0 - is correct, Main Signal, everytime same like on chart
1 - is nearly the signal value, but it is not the same!?
2 -> i don't know, but not signal or?

for example: chart shows now:

Stochbuffer: 40.81632653061313|74.02597402597415|92.38095238095116

Main is at 40,82, correct shown

Signal is at 69,74 !! but even not 74,03!???

Many questions...

And mybe a bug? If i change to silver, buffer[1] (Signal!?) in 4H is 0...?

(SILVER,M1)    Stochbuffer: 35.86956521738543|74.2857142857108|39.72602739725894

(SILVER,M30)  Stochbuffer: 85.24945770065118|62.09476309226906|47.27592267135337

in 4h

(SILVER,H4)    Stochbuffer: 2.431687139634019|0|17.4338319907942 every tick 0, maybe a bad bug, only in H4...?

(SILVER,D1)    Stochbuffer: 67.59460635058724|84.77337809815344|99.61066187481281


thanks for your patience ;)

can somebody help?

ok, found it... if i use STO_LOWHIGH it returns values... but the signal value is wrong:





Documentation on MQL5: Technical Indicators / iStochastic
  • www.mql5.com
Technical Indicators / iStochastic - Documentation on MQL5
 



where is the signal value, the point the same pixel in chart?
 

ok shame on me i understand, copybuffer 0 is main and copybuffer 1 is signal :D

and for both the last 3 values whre copied...

great :D

Reason: