Price action ima crossover without using candle property

 

ah... I been trying to figure out a way to identify action price crossover without using any of "iclose(), iopen()". The reason is because using candle property, it use specific candle, otherwise what I try to make its, to make the logic know that price did cross ima in history without specifically choosing which past candle history that did cross ima. To be honest Im confuse too and perhaps actually the correct way is to use candle property to identify it nonetheless. But I cant find any online source at all. The thing that I notice with my EA is that sometime price miss out on condition because of candle is further back even though it should be valid set up. Man if any senior programmer know the way around it or better option, please help me!

 
Norza Hekmily :

Hi Norza,

If you want to detect the crossing of the price with an IMA without using iClose() or iOpen(), you can work directly with the values of the iMA and the current price (Bid/Ask).

A simple way is to check if there is a sign change in the difference between the price and the iMA:

  • If (Current Price - Current iMA) and (Previous Price - Previous iMA) have opposite signs, it means that there was a crossover.

Another more detailed option is to compare the iMA in two consecutive periods and check if the price has crossed over:

  • Compare the current price with the current iMA.
  • Compare the price of the previous candle with the iMA at that time.
 
Miguel Angel Vico Alba #:

    Sorry man for late reply but I test your method couple of days ago and it actually work as intended. Thanks man!