Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 26
 0 Attachment(s)    

Thread: Modifications for a 5 digits broker

  1. #11

    Default

    Quote Originally Posted by przem81621 View Post
    double HMAA=iCustom(Symbol(),0,"HMA",HMAPeriod1,HMAMethod 1,HMAPrice1,2,0);
    double HMAB=iCustom(Symbol(),0,"HMA",HMAPeriod2,HMAMethod 2,HMAPrice2,2,0);

    hma indicator
    OK, so it's a form of moving average although I don't know what sort of value is returned from Buffer 2.

    On the basis that it's a price then yes, you would need to re-process your distance value for 3/5-digit brokers.

    One small tip if you're ever unsure about what values are being returned inside your EA. Just have the EA return those values in the form of a debug comment so that you can see what's happening.

    You simply set up an external bool called debug on Global Scope and a text string (maybe call it txt) containing the results of HMAA - HMAB and distance * Point.

    Then:

    if(debug) Comment(txt);

    You will be able to see straight away if it's working correctly or not and, if it's not working, you'll be able to see what's going wrong.

  2. #12
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Another alternative for the 5 digits broker "compatibility" :

    In the code, find all :

    Code:
    Digits
    And replace them by :

    Code:
    digits
    In the code, find all :

    Code:
    Point
    And replace them by :

    Code:
    point
    After the extern parameters, add :

    Code:
    int digits;
    double point;
    In the init() function, add before return(0); :

    Code:
    if(Digits<4)
    {
       point=0.01;
       digits=2;
    }
    else
    {
       point=0.0001;
       digits=4;
    }

  3. #13
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Another guide :

    After the extern parameters, add :

    Code:
    double point;
    In the init function add :

    Code:
    point=GetPoints();
    If there is no init function, add this before the start body :

    Code:
    int init()
    {
       point=GetPoints();
       
       return(0);
    }
    After the init function, add :

    Code:
    //|---------x digits broker
    
    double GetPoints()
    {
       if(Digits==3 || Digits==5)point=Point*10;
       else point=Point;
       return(point);
    }

  4. #14
    Senior Member
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    631

    Default

    rather than multiplying this and that for a 5 digit broker, can we just not make the EA compatible with 4 and 5 digit brokers in the first place.

    For example fapturbo and megadroid will automatically adjust to your broker and work with 4 and 5 digits, so you dont need to change anything. I know there are a lot of EAs out there that also do this, i was just using fapturbo and megadroid as an example!

    Is this easy to do, or not really!

  5. #15

    Default

    Quote Originally Posted by wannaberich View Post
    rather than multiplying this and that for a 5 digit broker, can we just not make the EA compatible with 4 and 5 digit brokers in the first place.

    For example fapturbo and megadroid will automatically adjust to your broker and work with 4 and 5 digits, so you dont need to change anything. I know there are a lot of EAs out there that also do this, i was just using fapturbo and megadroid as an example!

    Is this easy to do, or not really!
    This is exactly what both mine and Funyoo's code is doing. These blocks of code that have been posted adjust SLs, TPs, etc automatically within the EA code so that the user doesn't have to do anything.

  6. #16
    Senior Member
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    631

    Default

    Ok sounds good. So does that mean any new EAs that are put up will automatically work with 5 digit brokers

    Quote Originally Posted by jezzer1961 View Post
    This is exactly what both mine and Funyoo's code is doing. These blocks of code that have been posted adjust SLs, TPs, etc automatically within the EA code so that the user doesn't have to do anything.

  7. #17
    Junior Member
    Join Date
    Apr 2009
    Posts
    5

    Default auto SL TP adjustment for digits

    --------
    int HalfDigits,DoubleDigits;
    HalfDigits=MathFloor(MarketInfo(Symbol(),MODE_DIGI TS)/2);
    DoubleDigits=HalfDigits*2;
    if(DoubleDigits!=MarketInfo(Symbol(),MODE_DIGITS))
    {NewPipsBeforeSLatBreakeven=PipsBeforeSLatBreakeve n*10; NewPipsToTrail=PipsToTrail*10; NewAddLevelPoints=AddLevelPoints*10;}
    -------
    some brokers are going 6 digit - yes 6 digit! will this code work for 6 digit brokers or just for 5 digit brokers only?

    and what about JPY which has only 3 digits after the dec point? will your code work for JPY?

    what a mess!
    dph

  8. #18
    Senior Member
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    631

    Default

    no one is going to use a 6 digit broker, look at all the EAs out there that are going to be redone, you would have to be stupid to turn your self into a 6 digit broker now!

    I was quite happy with 4 digits, all my EAs worked just fine, now my broker is 5 digits many of then no longer work and some had to get the code changed. So there is no way i could be bothered going through this process again.


    Quote Originally Posted by dph View Post
    --------
    int HalfDigits,DoubleDigits;
    HalfDigits=MathFloor(MarketInfo(Symbol(),MODE_DIGI TS)/2);
    DoubleDigits=HalfDigits*2;
    if(DoubleDigits!=MarketInfo(Symbol(),MODE_DIGITS))
    {NewPipsBeforeSLatBreakeven=PipsBeforeSLatBreakeve n*10; NewPipsToTrail=PipsToTrail*10; NewAddLevelPoints=AddLevelPoints*10;}
    -------
    some brokers are going 6 digit - yes 6 digit! will this code work for 6 digit brokers or just for 5 digit brokers only?

    and what about JPY which has only 3 digits after the dec point? will your code work for JPY?

    what a mess!
    dph

  9. #19

    Default

    Which brokers exactly are going 6 digits? This sounds a bit strange to me.

  10. #20
    Junior Member
    Join Date
    Nov 2008
    Posts
    3

    Default

    dear funyoo,
    Does "Slippage" we need to multiply too?
    regards,
    MANSTIR

Similar Threads

  1. How to use an EA with a 5 digits broker
    By funyoo in forum Trading discussion
    Replies: 8
    Last Post: 04-07-2016, 13:58
  2. Phoenix_EA for 5 digits broker
    By r_wilson in forum Ideas for expert advisors
    Replies: 12
    Last Post: 05-25-2011, 18:45
  3. Price Bounce Off of MA EA - Excellent Potential Needs Modifications
    By kneal in forum Ideas for expert advisors
    Replies: 4
    Last Post: 12-07-2010, 16:16
  4. Replies: 3
    Last Post: 06-14-2010, 16:49
  5. Modifications for ECN brokers
    By funyoo in forum MQL programming
    Replies: 6
    Last Post: 01-11-2010, 14:53

Tags for this Thread

alpari, average, breakeven, broker, brokers, change, color, eas, expert, guide, how to, indicator, indicators, main, moving average, offer, rsi, signal, simple, slippage, stoch, stop, stoploss, trailingstop

Posting Permissions

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