Results 1 to 7 of 7
 1 Attachment(s)    

Thread: BasketPercent

  1. #1

    Default BasketPercent

    Hey funyoo.

    In order to avoid always asking for basic functions, could you enlight me how to add basketpercent function to a code?
    (I am not a programmer, so it will be on a copy-past base).

    thank you.

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

    Default

    Quote Originally Posted by civfan View Post
    Hey funyoo.

    In order to avoid always asking for basic functions, could you enlight me how to add basketpercent function to a code?
    (I am not a programmer, so it will be on a copy-past base).

    thank you.
    Hi civfan,

    Extern parameters :

    Code:
    extern bool basketpercent=false;       // enable the basket percent
    extern double profit=10;               // close all orders if a profit of 10 percents has been reached
    extern double loss=30;                 // close all orders if a loss of 30 percents has been reached
    Start body :

    Code:
    if(basketpercent){
          if(closebasket==false)closebasket=closebasketpercent(profit,loss);
          if(closebasket){closebuy();closesell();delete(OP_BUYSTOP);delete(OP_SELLSTOP);delete(OP_BUYLIMIT);delete(OP_SELLLIMIT);}
          if(closebasket && count(OP_BUY)+count(OP_SELL)+count(OP_BUYLIMIT)+count(OP_SELLLIMIT)+count(OP_BUYSTOP)+count(OP_SELLSTOP)==0)closebasket=false;
       }
    Functions :

    Code:
    //|---------basket
    
    bool closebasketpercent(double profit,double loss){
       double ipf,ilo;
       ipf=profit*(0.01*AccountBalance());
       ilo=loss*(0.01*AccountBalance());
       cb=AccountEquity()-AccountBalance();
       if(cb>=ipf || cb<=(ilo*(-1)))return(1);
       return(0);
    }
    
    //|---------delete
    
    void delete(int type){
       if(OrdersTotal()>0){
          for(i=OrdersTotal();i>=0;i--){
            OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
            if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==type){
              OrderDelete(OrderTicket());
            }   
          }
       }
    }

  3. #3

    Default

    Thank you funyoo, you are the man!

  4. #4

    Default

    well I guess I am not copy-past it right...

    "2;75;C:\Program Files\Broco backtesting\experts\The Channel Scalper 1.11ZZ.mq4;169:60;'profit' - variable not defined
    2;75;C:\Program Files\Broco backtesting\experts\The Channel Scalper 1.11ZZ.mq4;169:67;'loss' - variable not defined
    2;75;C:\Program Files\Broco backtesting\experts\The Channel Scalper 1.11ZZ.mq4;682:7;'basketmode' - variable not defined
    2;75;C:\Program Files\Broco backtesting\experts\The Channel Scalper 1.11ZZ.mq4;687:7;'basketmode' - variable not defined
    2;75;C:\Program Files\Broco backtesting\experts\The Channel Scalper 1.11ZZ.mq4;692:7;'basketmode' - variable not defined"

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

    Default

    Quote Originally Posted by civfan View Post
    well I guess I am not copy-past it right...

    "2;75;C:\Program Files\Broco backtesting\experts\The Channel Scalper 1.11ZZ.mq4;169:60;'profit' - variable not defined
    2;75;C:\Program Files\Broco backtesting\experts\The Channel Scalper 1.11ZZ.mq4;169:67;'loss' - variable not defined
    2;75;C:\Program Files\Broco backtesting\experts\The Channel Scalper 1.11ZZ.mq4;682:7;'basketmode' - variable not defined
    2;75;C:\Program Files\Broco backtesting\experts\The Channel Scalper 1.11ZZ.mq4;687:7;'basketmode' - variable not defined
    2;75;C:\Program Files\Broco backtesting\experts\The Channel Scalper 1.11ZZ.mq4;692:7;'basketmode' - variable not defined"
    Hi civfan,

    Be sure to add the extern parameters,

    There is no basketmode option.

  6. #6

    Default basket close

    Quote Originally Posted by funyoo View Post
    Hi civfan,

    Be sure to add the extern parameters,

    There is no basketmode option.
    hi this code does not work
    can you please check
    Morpheus Fx Solutions

  7. #7
    Banned
    Join Date
    Mar 2013
    Location
    www.fxsoft.ggfinances.com
    Posts
    53

    Default

    Quote Originally Posted by dave_rimmer View Post
    hi this code does not work
    can you please check
    Hi !
    There for You EA - its close all orders in +% from Depo. I like that code and used that in my strategies a lot )
    Visit our site forex profit - Home page
    Attached Files Attached Files

Tags for this Thread

add, backtesting, channel, copy, experts, forex, forex profit, funyoo, home, how to, mq4, profit, programmer, scalper, sells, strategies, thank you

Posting Permissions

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