Download MetaTrader 5

Discussion of article "Trading Ideas Based on Prices' Direction and Movement Speed"

To add comments, please log in or register
MetaQuotes Software Corp.
Moderator
189044
MetaQuotes Software Corp.  

New article Trading Ideas Based on Prices' Direction and Movement Speed has been published:

The article provides a review of an idea based on the analysis of prices' movement direction and their speed. We have performed its formalization in the MQL4 language presented as an expert advisor to explore viability of the strategy being under consideration. We also determine the best parameters via check, examination and optimization of an example given in the article.

Any movement in our world can be characterized by its direction, acceleration and speed. It works in liquid markets as well. This implies one important rule which says that never a one strong directed movement of the price can harshly end. It can be compared with a train: when a whole train set brakes at its full speed, its brake way can be up to one kilometer.

So when does a trend begin? When majority of market participants change their opinion to the contrary for some reasons whether it pertains to global change in direction or change in some important factors influencing on the market or news. With that a considered collective opinion is formed and the trend begins. Market participants have increasing belief that movement is becoming stronger and will go on further. It has a direction, acceleration and a certain speed because big players enter the market with large positions. This is where those, who entered at the beginning of the movement and gave it an impulse and speed, start gaining profit. Other traders enter the market later and with less attractive price. But unlike the first traders, they try to use the price movement direction.

The trend ends when changes occur. But why is the price still moving in the same way? Why doesn't it change abruptly? The reason of such behavior is that those, who were accelerating and pushing the price in the desired direction, start closing their positions and thereby suppress the trend. And those, who were just "riding the wave", still believe that nothing has changed and even try to move the price. But this "train" does not just stop. It starts moving in the opposite direction and here the story ends.

3. Enhancement of entry and exit efficiency

It is known that some trading indicators get up their speed of response to the trend change when we use a larger period. But more false signals appear as well.

The alternative way is not to change the calculation period to the lower side but to track it on several timeframes.

Fig. 3. Trend on different timeframes based on RSI and AC signals

Fig. 3. Trend on different timeframes based on RSI and AC signals

Author: Alexander Fedosov

Rasoul Mojtahedzadeh
31686
Rasoul Mojtahedzadeh  
There are a few bugs and typos in 'trading.mqh'. Attached you can find the fixed version.
Files:
trading.mqh 49 kb
Alexander Fedosov
9908
Alexander Fedosov  
Rasoul:
There are a few bugs and typos in 'trading.mqh'. Attached you can find the fixed version.
function Errors was correct.
656440
9
656440  

Sorry, I've tested this EA for a long period....this is the report :-(

 

Blahtech Limited
6191
James Cater  

Your speed_ac function is wrong, the if else blocks are backwards. the should look like this


void speed_ac()
  {
   double ac[];
   ArrayResize(ac,5);
   for(int i=0; i<5; i++)
      ac[i]=iAC(Symbol(),tf,i);
//---
   index_ac=0;
//--- buy signal
   if(ac[0]>ac[1] && ac[1]>ac[2] && ac[2]>ac[3] && ac[3]>ac[4])
      index_ac=4;
   else if(ac[0]>ac[1] && ac[1]>ac[2] && ac[2]>ac[3])
      index_ac=3;
   else if(ac[0]>ac[1] && ac[1]>ac[2])
      index_ac=2;
   else if(ac[0]>ac[1])
      index_ac=1;

 //-- sell signal
   else if(ac[0]<ac[1] && ac[1]<ac[2] && ac[2]<ac[3] && ac[3]<ac[4])
      index_ac=-4;
   else if(ac[0]<ac[1] && ac[1]<ac[2] && ac[2]<ac[3])
      index_ac=-3;
   else if(ac[0]<ac[1] && ac[1]<ac[2])
      index_ac=-2;
   else if(ac[0]<ac[1])
      index_ac=-1;
  }
Jeanyves Torres
302
Jeanyves Torres  

well the basic idea is interesting at first

you should take a look on speed and acceleration  (file in attachment)

I think you will be able to set up a better strategy than AC

Good luck

jaguar1637 from http://beathespread.com 

Alexander Fedosov
9908
Alexander Fedosov  
j-yves Torres:

well the basic idea is interesting at first

you should take a look on speed and acceleration  (file in attachment)

I think you will be able to set up a better strategy than AC

Good luck

jaguar1637 from http://beathespread.com 

I do not quite understand what this indicator is better AC?

Especially this part of the code:

if(StringSubstr(Symbol(),3,3)=="JPY")
     {
      MUL_SPEED=1000.0;
      MUL_SPEED2=1.0;
     }
   else
     {
      MUL_SPEED=1000.0;
      MUL_SPEED2=1.0;
     }
Alexander Fedosov
9908
Alexander Fedosov  
I slightly corrected your code
georgeP
59
georgeP  
Alexander Fedosov:
I slightly corrected your code
j-yves Torres:

well the basic idea is interesting at first

you should take a look on speed and acceleration  (file in attachment)

I think you will be able to set up a better strategy than AC

Good luck

jaguar1637 from http://beathespread.com 

Interesting article.  I like the possibilities of the AC indicator.  Your basing the principles on physics.  But there is one factor missing.  Psychology.  Or is there?  In physics we know that the steeper the angle the greater the acceleration.   When the angle reaches deceleration it tends to curve or in the case of trading it may stop altogether. But inertia comes with a bang when stopped suddenly and two objects meet each other. The force is greater. But if there is no opposing force the impact remains the same. In trading the waves are counted and a shortening of the thrust usually determines the trend direction or reversal.  But it is an interesting assumption, and I shall try the AC indicator just for fun! He! He! Isac Newton would love it! And so would Einstein!
Jeanyves Torres
302
Jeanyves Torres  

hi

 Well, there is another possibility, regarding the replacement of AC, PFE , and also DPO 

Dr Matthias Hammelsbeck
571
Dr Matthias Hammelsbeck  
James Cater:

Your speed_ac function is wrong, the if else blocks are backwards. the should look like this


Hi,

I noticed the same error in the speed_ac function. Thanks for the hint. This error limits the return values for index_ac to 0, 1 or -1 affecting the Buy(), Sell(), Buy_close() and the Sell_close() function.

Here is my version returning the index_ac value and with the additional advantage of minimizing the number comparisons:

   int speed_ac () {
      double ac[5];
      for (int i = 0; i < 5; i++) {
         ac[i] = iAC (m_symbol, m_timeframe, i);
      }
      if (ac[0] > ac[1]) {
         if (ac[1] > ac[2] {
            if (ac[2] > ac[3]) {
               if (ac[3] > ac[4]) {
                  return 4;
               }
               return 3;
            }
            return 2;
         }
         return 1;
      }
      if (ac[0] < ac[1]) {
         if (ac[1] < ac[2] {
            if (ac[2] < ac[3]) {
               if (ac[3] < ac[4]) {
                  return -4;
               }
               return -3;
            }
            return -2;
         }
         return -1;
      }
      return 0;
   }

 

 Similarly I changed the depth_trend function:

 

   int depth_trend () {
      double rsi = iRSI (m_symbol, m_timeframe, m_RSI_period, PRICE_CLOSE, 0);
      if (rsi > 90.0) return 4;
      if (rsi > 80.0) return 3;
      if (rsi > 70.0) return 2;
      if (rsi > 60.0) return 1;
      if (rsi < 10.0) return -4;
      if (rsi < 20.0) return -3;
      if (rsi < 30.0) return -2;
      if (rsi < 40.0) return -1;
      return 0;
   }

 

 The use of these function in OnTick() is the following:

void OnTick() {
   int index_rsi = depth_trend();
   int index_ac = speed_ac();
...
}

 Now I' m finishing my modifications and I'm looking forward to see test results for this good idea of Alexander. 

 Happy trading

Matthias 

12
To add comments, please log in or register