Firstly, you need to tidy the code up and insert the correct variables. Let's say that you want the highest high for the last two weeks, you would need to change it to something like this:
Code:
double HighestHigh = iHigh( Symbol(), 1440, iHighest( Symbol, 1440, MODE_HIGH, 12, 0) );
The 1440 refers to the number of minutes in the D1 timeframe. The 12 refers to the last 12 days. I have used 12 instead of 10 because some brokers have a price bar for the 2 or 3 hours that they are open on a Sunday evening. For these brokers, the market is effectively open 6 days a week, while it is only open for 5 days with other brokers.
You would put that block of code towards the top of your start() function.
I don't know exactly what you want to use as your rule, but let's suppose that you don't want to trade if the price is within 50 pips of its 2 week high. You would need some further code underneath the first line like this:
Code:
if(MathAbs(HighestHigh-Bid)<=50*Point) return(0);
The MathAbs function effectively turns negative numbers into positive numbers. So if you are within 50 pips either below or above the high, the return(0) instruction will just send control back to the beginning of the start() function and the rest of the code will remain unread until the price moves one way or the other away from its recent high.