Download MetaTrader 5

Indicator alert showing different result

To add comments, please log in or register
luckyvictor
63
luckyvictor  

Hi 

I am pretty new to this, I have downloaded a stochastic cross alert indicator, but I don't get my expected result.

On a M15 chart, I literally have signal every 15 mins, and the buy and sell signal is just totally wrong. 

I have attached the code, and someone please help me to debug this.

Many thanks

Vic

Files:
Mladen Rakic
64143
Mladen Rakic  
luckyvictor:

Hi 

I am pretty new to this, I have downloaded a stochastic cross alert indicator, but I don't get my expected result.

On a M15 chart, I literally have signal every 15 mins, and the buy and sell signal is just totally wrong. 

I have attached the code, and someone please help me to debug this.

Many thanks

Vic

That is repainting indicator

Use some correctly coded stoch crossing indicator

luckyvictor
63
luckyvictor  
Mladen Rakic:

That is repainting indicator

Use some correctly coded stoch crossing indicator


Thank you for your quick reply.

What do you mean exactly please? I don't quite understand why it is not a correctly coded stoch crossing indicator.

I understand the code in this way, when K cross D, it draws an arrow on the chart, and at the same time sends out alert. However, I don't understand why the drawing is done outside the if condition of the newbar.

whroeder1
16306
whroeder1  
stochastic1now      = iStochastic(NULL,0,KPeriod1,DPeriod1,Slowing1,MAMethod1,PriceField1,0,i);
stochastic1previous = iStochastic(NULL,0,KPeriod1,DPeriod1,Slowing1,MAMethod1,PriceField1,0,i+1);
stochastic1after    = iStochastic(NULL,0,KPeriod1,DPeriod1,Slowing1,MAMethod1,PriceField1,0,i-1);

stochastic2now      = iStochastic(NULL,0,KPeriod1,DPeriod1,Slowing1,MAMethod1,PriceField1,1,i);
stochastic2previous = iStochastic(NULL,0,KPeriod1,DPeriod1,Slowing1,MAMethod1,PriceField1,1,i+1);
stochastic2after    = iStochastic(NULL,0,KPeriod1,DPeriod1,Slowing1,MAMethod1,PriceField1,1,i-1);

diff = stochastic1after - stochastic2after;
It is a repainting indicator. For any specific candle, it uses the stochastic before, current, and after. What you get at the start of a new bar is different than what you get at the end of the bar. Therefor it is useless for trading.
luckyvictor
63
luckyvictor  
whroeder1:
It is a repainting indicator. For any specific candle, it uses the stochastic before, current, and after. What you get at the start of a new bar is different than what you get at the end of the bar. Therefor it is useless for trading.

So how does it iStochastic function work?


how can I create a useful stochastic cross alert please?

whroeder1
16306
whroeder1  
Look at the real Stochastic indicator Data Structure in MetaTrader 4 Build 600 and Higher - MQL4 Articles 17.02.2014
To add comments, please log in or register