Quote:
Originally Posted by yyc196
Hi,
I realized that after the market has gone for a great moves (up or down trend). The remaining market is somehow risky to trade with. I am trying to program an EA to avoid entering any trades say after a great move of about 90pips.
I need to know how to calculate the number of pips from first bar at 8am (london market open) to the current bar. If the market has already been moved for more than 90pips I will not take any trade.
Can someone code a few line to give me some clues? Many thanks and appreciated.
Shek
|
If needed, check first that you are later than 8 am:
PHP Code:
if(Hour() < 8) return;
Then, find the max and min of the current day. (if its ok for you, its easier than from 8 am):
PHP Code:
double Max = iHigh(Symbol(), PERIOD_D1, 0);
double Min = iLow(Symbol(), PERIOD_D1, 0);
int Range = (Max - Min) / Point;
if(Range > 90) return;
...