Results 1 to 5 of 5
 0 Attachment(s)    

Thread: Market high and low

  1. #1
    Junior Member
    Join Date
    May 2009
    Posts
    19

    Default Market high and low

    any way to keep ea from trading if at top of market price during the past (x) weeks and low as well.

    ex.

    eurusd range 1.4177 - 1.3748

    only trade within 20 pips

    thanks

  2. #2

    Default

    You find the highest high like this:

    Code:
    double HighestHigh = iHigh( string symbol, int timeframe, iHighest( string symbol, int timeframe, int type, int count=WHOLE_ARRAY, int start=0) )
    The opposite applies in finding the lowest low. You just need to define the variables.

    You can then use the result within your conditions for trading.

  3. #3
    Junior Member
    Join Date
    May 2009
    Posts
    19

    Default

    thanks for the quick responce!

    im not quite a coder yet

    would i put this in front of the int start or int openbuyorder

    thanks

  4. #4

    Default

    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.
    Last edited by jezzer1961; 06-19-2009 at 07:23.

  5. #5
    Junior Member
    Join Date
    May 2009
    Posts
    19

    Default

    this is exactly what im looking for! Thank you - Thank you - Thank you...

    im using vforce 2 and trying to avoid open orders for more than a few days.

    thanks again

Similar Threads

  1. High Low v2 EA
    By funyoo in forum Expert advisors backtesting
    Replies: 8
    Last Post: 07-05-2015, 15:44
  2. Emerging Market Economies Impact On Fx Market
    By painofhell in forum Fundamentals
    Replies: 0
    Last Post: 02-03-2015, 23:38
  3. High Frequency EA??? Extremely High Number of Trades
    By joseclar in forum Expert advisors live statements
    Replies: 1
    Last Post: 01-21-2011, 10:37
  4. There is market time, but what about market date???
    By dennerle in forum MQL programming
    Replies: 2
    Last Post: 09-20-2010, 04:27
  5. High frequency EA- High number of trades
    By joseclar in forum Ideas for expert advisors
    Replies: 2
    Last Post: 02-28-2010, 08:50

Tags for this Thread

brokers, change, high, low, thank you, trading

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •