MQL4 Biggest body between last 20 candle - page 3

 

<CODE REMOVED>

 
 
tang15021122935:

<CODE REMOVED>


I removed your code . . . .


Please edit your post above and re-insert your code using the SRC button . . . please use the SRC button to post code: How to use the SRC button.

To edit your post . . .

 
mostafa:
double badaneh = (O-C)/Point;

Any dividing with Point (or other) in such cases (especially if it is on PERIOD_M1 chart) when often bars are same price high and low, big % that script will be closed with zero_divide error.
 
rfb: Any dividing with Point (or other) in such cases (especially if it is on PERIOD_M1 chart) when often bars are same price high and low, big % that script will be closed with zero_divide error.
double badaneh = (O-C)/Point;
False. Point is 0.01 (jpy 4 digit broker) to 0.00001 (non-jpy 5 digit). Point is not zero, can NOT result in a zero divide. Dividing by badaneh might.
 
WHRoeder:
False. ... can NOT result in a zero divide. Dividing by badaneh might.

True. Didn't give example, my explanation was short, sorry.

 double open = 0.0 , close = 0.0 , checkzero = ( open - close ) / Point ; // -> == OK
 Print ( " ( open - close ) / Point = " , checkzero ) ;
 double fx = checkzero / ( open - close ) ; // this one results with mentioned zero-divide error
 Print ( " checkzero / ( open - close ) = " , fx ) ; 

I wasn't detailed, but ... it is rare someone to stop there at first point of calculations without further calculations. (This is my case).

Anyway, thanks for correcting me, you were correct.

 

Hi,

Anybody have the indicator for 50% body candle identification by color. (All time frames)

Regards,

Robert

 
 
double maxCandle( int candles, int start){
   double maxi=-999999;
   for(int i=start; i<candles+start; i++){
      double size=(High[i]-Low[i])/Point;
      if( size>maxi ) maxi=size;
   }
   return maxi;
}

double bigCandle=maxCandle( 64, 0 );  // return the biggest candle(in points) ... over last 64 candles
Reason: