Discussing the article: "Revisiting an Old Trend Trading Strategy: Two Stochastic oscillators, a MA and Fibonacci."

 

Check out the new article: Revisiting an Old Trend Trading Strategy: Two Stochastic oscillators, a MA and Fibonacci..

Old trading strategies. This article presents one of the strategies used to follow the trend in a purely technical way. The strategy is purely technical and uses a few technical indicators and tools to deliver signals and targets. The components of the strategy are as follows: A 14-period stochastic oscillator. A 5-period stochastic oscillator. A 200-period moving average. A Fibonacci projection tool (for target setting).

The trading rules of the strategy are as follows:

  • A long signal is generated whenever both stochastic oscillator reach the oversold level at the same time, bounce, and then come back to it (around the same time). The whole process must be done while the market is above the 200-period moving average. The first target is set using the Fibonacci projection tool applied from the low of the first time the stochastic oscillators reached their bottom and the low of the second time they reached their bottom. The first target is therefore the 61.8% projection and the second target is the 100.0% projection.
  • A short signal is generated whenever both stochastic oscillator reach the overbought level at the same time, bounce, and then come back to it (around the same time). The whole process must be done while the market is below the 200-period moving average. The first target is set using the Fibonacci projection tool applied from the high of the first time the stochastic oscillators reached their top and the high of the second time they reached their top. The first target is therefore the 61.8% projection and the second target is the 100.0% projection.

(I've implemented a change in the strategy, to have stop levels in each Fibonacci level)

The following Figure shows a bearish signal:

bearish


Ultimately, the results may vary from market to market and the current results may not be stable. Strategies work during certain periods but may underperform during others.

Author: Javier Santiago Gaston De Iriarte Cabrera

 

That's probably the article I have read with the worst code I have ever seen, no offense intended, just facts. Don't use that ever on a live account. 

   int Highest = iHighest(Symbol(),my_timeframe,MODE_REAL_VOLUME,WHOLE_ARRAY,1);

What are you thinking this is doing ?

There is no real volume data on most symbols, except on Futures and Stocks. On Forex this will always return 1. Highest is always = 1.

Then you are using this index (Highest obtained on real volume) to get the a High value :

   double highestValue = iHigh(Symbol(),my_timeframe,Highest);

You are mixing things which should not be mixed (unless you know what you are doing). How is a "High" price value related to a real volume ?

Anyway, it will always give the same as High[1] which apparently is what you was trying to get. But then why not get it directly without this diversions through iHighest and real volume ?

I will not go further. You said :

the aim of this article is to help people understand how to program in MQL5

If someone want to understand how to program in MQL5, I would recommend to avoid this article at all prices.

 
Alain Verleyen #:

That's probably the article I have read with the worst code I have ever seen, no offense intended, just facts. Don't use that ever on a live account. 

What are you thinking this is doing ?

There is no real volume data on most symbols, except on Futures and Stocks. On Forex this will always return 1. Highest is always = 1.

Then you are using this index (Highest obtained on real volume) to get the a High value :

You are mixing things which should not be mixed (unless you know what you are doing). How is a "High" price value related to a real volume ?

Anyway, it will always give the same as High[1] which apparently is what you was trying to get. But then why not get it directly without this diversions through iHighest and real volume ?

I will not go further. You said :

the aim of this article is to help people understand how to program in MQL5

If someone want to understand how to program in MQL5, I would recommend to avoid this article at all prices.


I explain the strategy, that is my aim. You can code you're own program. That is just an example. I'm in the situation of having to show resuls, that is why I upload a simple EA. The real aim is to show the strategy. 

Yes, you are right, this is not usefull to learn programming, this is just to show a strategy.

 

Agreed with Alain on that, worst coder I've seen too. Here is the fix if that could help: (replace the first part of OnTick() function)

MqlTick tick;
SymbolInfoTick(_Symbol,tick);

int highest_index = iHighest(NULL,0,MODE_CLOSE,100,0);
int lowest_index = iLowest(NULL,0,MODE_CLOSE,100,0); 

if(highest_index == -1 || lowest_index == -1) { 
   PrintFormat("iHighest()/iLowest() call error. Error code=%d",GetLastError());
   return;
 }

double previousHigh = iHigh(NULL, PERIOD_CURRENT, highest_index);
double previousLow = iLow(NULL, PERIOD_CURRENT, lowest_index);
double currentHigh = iHigh(NULL, PERIOD_CURRENT, 1);
double currentLow = iLow(NULL, PERIOD_CURRENT, 1);
 

The explanation is clear but the code has a lot of unnecessary declarations and lines.

I don't see where the MA condition is compared and the Stochastic condition converging with the MA trend indication.

Please point it out, maybe the code can modified and simplified.

I ran the EA, unfortunately it does not execute trades.