- Print your variables and calculations and find out why.
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;
}
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.
- Please EDIT your post and use the "SRC" icon when including sample source code.
- 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.
- 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.
Should be
Sm*10000 < 25 // 1 of few conditions
Sm*10000 < 25 // 1 of few conditions
"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!"
"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.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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;
}