KST (Know Sure Thing) oscillator

virtuado

Master Trader
Aug 5, 2016
56
9
49
A while ago i got interested in this oscillator originally developed by Martin J. Pring.

To get notified i added signalline crossover alert and zeroline crossover alert.

The former seems to work well, but the latter doesn't give an alert when the zeroline is crossed.

When i added the alert lines initially i did get several errors, so i added the integers on line 98 as well.

I think the issue is which integer from this line i need to add on line 263 and 272, but am not sure.
Can somebody please look into this?
 

Attachments

Last edited:

Enivid

Administrator
Staff member
Nov 30, 2008
12,261
481
114
Odessa
www.earnforex.com
This condition will never be true because it requires SignalBuffer[0] to both less than zero and equal or greater than zero:
MQL4:
if ((SignalBuffer[0] < 0) && (SignalBuffer[0] >= 0) && (Bars > c))
 

virtuado

Master Trader
Aug 5, 2016
56
9
49
Makes sense what you stated.

I changed it now, and it seems to work.
But i have my doubt if it's really good?
Can you have a sneak peak at?

Can you also enlighten me what integers i should put on the end of line 263 and 272, i added (c), but that was my non-coder logic... :)
 

Attachments

Enivid

Administrator
Staff member
Nov 30, 2008
12,261
481
114
Odessa
www.earnforex.com
Should be checking Bars against 'd', not 'c' on line 272:
MQL4:
      if ((KST[0] > 0) && (SignalBuffer[0] <= 0) && (Bars > c))
The logic here is to prevent more than one alert per bar popping up.

As for the logic of the alert conditions, I have no idea. Launch it in a visual backtest see.
 

virtuado

Master Trader
Aug 5, 2016
56
9
49
Is there a way to code the alerts in a way that once a crossing of signal line and/or zero line has occured the next alert will only be send once the next crossing occurs?
Right now the alerts are send every time i start mt4, also for crossings which occured several bars ago.

I searched for it but could not find the proper info?
 

Enivid

Administrator
Staff member
Nov 30, 2008
12,261
481
114
Odessa
www.earnforex.com
Yes, when you are checking for crossing, you have to check that the current value is above/below the threshold level and the previous value is below/above that level. That way, the next bar after crossing occurs will not qualify for an alert unless there is a new crossing at that time.