opening conditions

 
plz help

How to code the lenght of candle shadow as a condition to order opening.
if (x
&& x
&& x
&& 1000*(Close[1]-Low[1]) < 15 ) // max 15 pips of shadow condition - doesnt work - at image there is 40 pips shadow.

{
res=OrderSend(Symbol(),OP_BUY,0.1,A sk,3,SL,TP,"",MAGICMA,0,Blue);

return;

}

 
 
  1. Print your variables and calculations and find out why.
  2. 1000*(Close[1]-Low[1]) < 15 ) // max 15 pips 
    Don't hard code numbers, that fails on JPY pairs.
    double pips2dbl = Point; if(Digits % 2 == 0) pip2dbl = 10.0 * Point; 
    Close[1]-Low[1] < 15 * pips2dbl) // max 15 pips 

 

thank you for remark. currently working only on a EURUSD.

I have change it a little bit. but still there is some bug in variables.

int    res;
     double SL, TP, Sm;
     SL= iLow(NULL,PERIOD_D1,0)-50*Point;
     TP= Close[1]- 2*(SL-Close[1]);

     Sm= Close[1]-iLow(NULL,PERIOD_D1,0)-50*Point;


 Sm*1000 < 25          // 1 of few conditions

{
      res=OrderSend(Symbol(),OP_BUY,0.1,Ask,3,SL,TP,"",MAGICMA,0,Blue);
      return;
     }

  
  

 
Brt88:

thank you for remark. currently working only on a EURUSD.

I have change it a little bit. but still there is some bug in variables.

  1. Please EDIT your post and use the "SRC" icon when including sample source code.
  2. Just because you are currently only using EURUSD", that should not serve as an excuse to hard coding numbers. WHRoeder is a very experienced coder and his suggestions should not be dismissed so lightly.
  3. WHRoeder, instructed you to insert "Print()" statements in order to debug and see the results of the various steps, yet you have dismissed that too.
 
Brt88:


  
  

Should be

 Sm*10000 < 25          // 1 of few conditions
 
angevoyageur: Should be
 Sm*10000 < 25          // 1 of few conditions
No it shouldn't That assumes a non-JPY/non-metal pair.
 
WHRoeder:
No it shouldn't That assumes a non-JPY/non-metal pair.
Yes as he trades EURUSD. Not everyone want lessons on how to become coder, some just need a solution to their issue.
 
WHRoeder: No it shouldn't That assumes a non-JPY/non-metal pair.
angevoyageur: Yes as he trades EURUSD. Not everyone want lessons on how to become coder, some just need a solution to their issue.

"Give a man a fish and you feed him for a day; teach a man how to fish and you feed him for a lifetime!"

 
FMIC:

"Give a man a fish and you feed him for a day; teach a man how to fish and you feed him for a lifetime!"

Ok mister professor, but some people are vegetarians or just don't want to fish all their life, ask them before trying to feed them for life.
 
angevoyageur:
Ok mister professor, but some people are vegetarians or just don't want to fish all their life, ask them before trying to feed them for life.
How did you guess that my nick-name in high-school was "Prof"?
Reason: