Thread: Ask!
View Single Post
  #1054 (permalink)  
Old 04-22-2008, 06:04 PM
Michel Michel is online now
Senior Member
 
Join Date: Feb 2006
Posts: 558
Michel is on a distinguished road
Quote:
Originally Posted by yyc196 View Post
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_D10);
double Min iLow(Symbol(), PERIOD_D10);
int Range = (Max Min) / Point;
if(
Range 90) return;
... 
Reply With Quote