The ATR value for the 05.00hr bar is 40.
Immediately upon execution of the sell market order within the 05.30hr bar, we will put on a pending oder to sell at half the ATR value of bar '1' (20 pips)
Sell price 1.33333. The pending price will be 1.33353
A point is not a pip on a five digit broker. A pip is 10 points.
The ATR value is 40 points (4 pips)
The pending price 1.33353 is 2 pips (20 points) above 1.33333
Most brokers won't allow placing pending orders closer than 3 pips from current: MarketInfo( Symbol(), MODE_STOPLEVEL )*Point
//++++ These are adjusted for 5 digit brokers. double pips2points, // slippage 3 pips 3=points 30=points pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init() { if (Digits == 5 || Digits == 3) { // Adjust for five (5) digit brokers. pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; }
A point is not a pip on a five digit broker. A pip is 10 points.
The ATR value is 40 points (4 pips)
The pending price 1.33353 is 2 pips (20 points) above 1.33333
Most brokers won't allow placing pending orders closer than 3 pips from current: MarketInfo( Symbol(), MODE_STOPLEVEL )*Point
WHRoeder
Your prompt reply is appreciated fully. There is so much more to learn.
The mentioning of the difference in points and pips helps in flattening my learning curve.
I will breakdown your solution line by line and put it to use.
Thank you again so much.
Cheers
Huckleberry
WHRoeder
Your prompt reply is appreciated fully. There is so much more to learn.
The mentioning of the difference in points and pips helps in flattening my learning curve.
I will breakdown your solution line by line and put it to use.
Thank you again so much.
Cheers
Huckleberry
Hello WHRoeder
Ok I see the error on my part. The pending price should be showing 1.33533. I am dealing srictly with pips.
Also in my rush in typing out the original problem, I used 'sell' intead of 'buy'.
Please excuse my faults due to my haste.
I will rewrite the problem and insert SRC.
Have a good weekend.
Huckleberry

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello Folks and Gurus of all kind,
Here are the elements to use for figuring out this problem.
Working on an EA
30 minute timeframe
An ATR(20), (calculated on 20 bars)
For grins and giggles, we will create a sell market order within the 05.30hr
According to MQL, at this present time, this 05.30hr bar is considered as ATR[0]
The bar prior to it, 05.00hr, is ATR[1]
The ATR value for the 05.00hr bar is 40.
Immediately upon execution of the sell market order within the 05.30hr bar, we will put on a pending oder to sell at half the ATR value of bar '1' (20 pips)
Sell price 1.33333. The pending price will be 1.33353
The problem is later in time, for instance, 07.30hr, the price has moved so as to execute the pending order 1.33353
The program should be coded so that another pending sell order will be launched at a 20 pip distance, (1.33373). BUT the ATR value for the 07.00 hr bar, which is now ATR[1] has a value of 60. The 05.00hr bar has incremented to ATR[5]
The program should have this same ordering sequence. The sequence of createing pending sell orders at a 20 pip distance, as long as the price trends in a favorable direction. All orders will have the same size.
I am not concerned with the stop
Trend reversal will pull out all positions
Cheers
Huckleberry