Difference between the Highest High of last 50 bars and Current candle Low

 

Hello friends,

I am new to coding in MT4

Can some body help me with coding, how to calculate the Difference between the Highest high of last 50 bar minus the current bar low , I need to see the difference of Pips

Kind Regards,

Siraj

 

You need to learn codeing! Start from here:

https://www.mql5.com/en/forum/161544

https://www.mql5.com/en/articles/1391
https://www.mql5.com/en/forum/169973#comment_4084078

Where do I start learning to build a robot?
Where do I start learning to build a robot?
  • 2016.11.18
  • www.mql5.com
Hello all, I have been trading forex for a while, but would like to get into using robots and building my own. My broker is forex...
 

Please coder help me to figure this out, am I doing correct

      int    HHbar = iHigh(NULL, 0, iHighest(NULL,0,MODE_HIGH,50,0) );
      int    LLbar = iLow(NULL, 0, iLowest(NULL,0, MODE_LOW,50,0) );
      double HH    = High[HHbar]; // iHigh(NULL,0, HHbar)
      double LL    = Low[LLbar]; //  iLow(NULL,0, LLbar)
      
      
      if(
       MathAbs(LL-High[i]) > 20
      )

Please coders help me out , am I doing correct ?

I want to see if the difference is more then 20 pips or........

 
SIRAJ Multani: Please coders help me out , am I doing correct ?

I want to see if the difference is more then 20 pips or........

No, you are missing the last step. You are calculating the difference (e.g. 1.23456-1.23499=0.00043.) Divide by the size of a PIP (e.g. 0.0001) to get 4.3 PIPs. Adjusting SL, TP, and slippage; for 4/5 digit brokers and for JPY pairs.
 
whroeder1:
No, you are missing the last step. You are calculating the difference (e.g. 1.23456-1.23499=0.00043.) Divide by the size of a PIP (e.g. 0.0001) to get 4.3 PIPs. Adjusting SL, TP, and slippage; for 4/5 digit brokers and for JPY pairs.
How can we write that in the code, can u show me please
 
  1. Can you click on provided links?
  2. Don't double post

Reason: