brekin

To add comments, please log in or register
texoro
170
texoro  
Hello all friends I would like to graphize this situation (in the attached image) and issue an alert when the shadow of the second candle is higher than the shadow of the first candle, I created the following function but I can not understand what is wrong at the theoretical level seems right but when I go to do the test does not work as I want, someone has ideas
 Thank you in advance
double HighPrec= High[1], HighCurr= High[0], LowPrec= Low[1], LowCurr= Low[0];
      
      if(High[1]<High[0])// Sell
       {
        AllertoPerIlRibasso();
        return - 1; 
       }


paul selvan
588
paul selvan  
return - 1;

which function do it ?

William Roeder
18310
William Roeder  
texoro: but I can not understand what is wrong at the theoretical level seems right but when I go to do the test does not work as I want,
  1. We can't know what is wrong either because you haven't stated a problem. "Does not work as I want" requires a mind-reader.

  2. Only MT4 has a predefined array High. Why did you post your MT4 question in the Root / MT5 General section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.

  3. High[1] < High[0] is the test for what your images shows (circled part.) State your problem.

  4. This image also has a higher high. Are you sure you still want to sell? Higher high
texoro
170
texoro  
 int breakIn()
   {
   //double HighPrec= High[1], HighCurr= High[0], LowPrec= Low[1], LowCurr= Low[0];
      
      if(High[1]<High[0])// Sell
       {
        AllertoPerIlRibasso();
        return - 1; 
       }
      else if(Low[1] < Low[0])//buy
       {
        return + 1;
       }
       
       return 0;
   }
   



I'm sorry, I realized I posted half a service, basically:


Sell

when the upper shadow of the candle in formation exceeds the maximum of the previous candle therefore "high[0] > high[1] " must return -1;


Buy 

the opposite situation

paul selvan
588
paul selvan  
if(High[1]<High[0])// Sell

do you want to sell when bulls are burgeoning ?

lippmaje
610
lippmaje  

I think what the OP is referring to is a retraction from the previous close, indicating a price contraction.

I'd formulate it as this:

if(High[1]<High[0] && Close[1]>Close[0])// Sell
 {
   AllertoPerIlRibasso();
 }

This means, if the current high topped the previous high, but the Bid (which is denoted in Close[0]) fell below the previous close, then sell.

Be aware that such a premise might right away burn your position.

texoro
170
texoro  
Guys then I update the post 
Practically this function must work to tick to not to closed candle, therefore between is in formation the last candle;

Sell
If the upper shadow of the candle in formation exceeds the maximum of the previous candle then "high[0] > high[1] " 
I need to get a -1;

Buy
If the lower shadow of the candle in formation is lower than the minimum of the previous candle then "Low[0]< Low [1] " 
must come back to me +1;


 Attached explanatory image

To add comments, please log in or register