Add a maxspread

Results 1 to 3 of 3
 0 Attachment(s)    

Thread: Add a maxspread

  1. #1
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,011

    Default Add a maxspread

    Also called Spread Filter :

    At the beginning of the code, after extern parameters, add :

    Code:
    extern int MaxSpread=2;
    After start(){, add :

    Code:
    if((Ask-Bid)>MaxSpread*Point)return(0);
    And that's all.

  2. #2

    Default

    The problem that I can see with this idea, Funyoo, is that if you already have an open position the EA will not be able to close it if the spread changes.

    I realise that it's probably intended for scalping EA's where the spread can be critical, but it is important to either use TP's and SL's when the order is sent to open the position or, alternatively, you would have to think carefully about the sequence of lines in the rest of the code.

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

    Default

    Quote Originally Posted by jezzer1961 View Post
    The problem that I can see with this idea, Funyoo, is that if you already have an open position the EA will not be able to close it if the spread changes.

    I realise that it's probably intended for scalping EA's where the spread can be critical, but it is important to either use TP's and SL's when the order is sent to open the position or, alternatively, you would have to think carefully about the sequence of lines in the rest of the code.
    Indeed you are right. The conditions to exit have to be set before this line.

Posting Permissions

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


Add a maxspread


GadgetVersus GadgetVersus France W3Ask W3Ask Brasil W3Ask Deutschland W3Ask Espaņa W3Ask France W3Ask Italia W3Ask Nederland