Hi, what have you got so far?
If this is what you want:
I need to initiate order when the current bar is opened at some price and moved 5 pips high or low and return to the open price.
You can make it easier.
Is this MQL4?
Compare Open[0] to High[0] - this should be greater than 5 pips.
Compare Open[0] to Close[0] - this will tell you if price has returned to the open price.
Use Volume[0] if you want it to happen within so many ticks.
You also might want to change this:
It won't work on JPY crosses, or 4 digit brokers.
you mean to say the below code will work:
if((High[0] - Open[0] >= 0.0005) && (Open[0] == Close[0])){
//initiate Buy
}
That's the general gist of it.
A few extra things to consider...
I would do Open[0]<=Close[0] rather than ==
I would restrict how many orders can be placed each bar. Otherwise, if price stays below the Open it will keep firing off buy orders.
//initiate Buy
}
-
Play videoPlease edit your post.
For large amounts of code, attach it. - You are not adjusting for 4/5 digit brokers/JPY pairs. (5 * pip)double pip = StringFind(_Symbol,"JPY") < 0 ? 0.01 : 0.0001;
int pip_digits = (int)MathLog10(pip/_Point);
int slippage = 3 * int(pip / _Point); - The two values will never be equal The == operand. - MQL4 forum as honest_knave pointed out.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi Techies,
I need to initiate order when the current bar is opened at some price and moved 5 pips high or low and return to the open price.
Please help me.
regards,
Naveen