View Single Post
  #1106 (permalink)  
Old 09-17-2007, 12:28 PM
basza's Avatar
basza basza is offline
Senior Member
 
Join Date: Dec 2005
Posts: 161
basza is on a distinguished road
Quote:
Originally Posted by MrPip View Post
I am open to suggestions for removing code from the EA. If things like HA, HAS, CCI or Stochastics filters should be removed let me know. We should also work toward a single MM function.

Some of the filter indicators will be tested for exit as well. I am ecen thinking of using confirmation of arrow similar to entry rule.

That might allow some trades to reach greater profit, especially those trades that have many exit arrows after the first exit signal.

Suggestions for other exit methods are also welcome.
I will be coding a few myself.

Robert
Hello MrPip

I have this mm in some of my ea's. I don't know if it would help you or not but I will post it just in case:
This bit goes at the top so that the user can choose which type they want
Code:
//////
/* Here is the MM settings...look at notes...if set to 0 then ea will trade with a fixed lot size..the size specified 
   in the above "extern double Lots = 1.0;" line. Might want to change this to 0.1.
   If 1 then it will trade a fixed percentage of the account balance
   If 2 then it will use a fractional portion (not to sure on this one..must look at code again)
   If 3 then a fractional fixed size meaning 1 lot for every 500 in account or so...the 500 is set below
     in the LotsDepoForOne - i.e. How many lots for each deposit amount of = 
     
     You must play around with it..cannot remember exact settings but I likes the setting to trade 1 lot for each $xx in account.
     Easy to maintain a say 500:1 ratio with it.
  */   

extern int LotsWayChoice  = 3;    // Lot size selection: 
                                  //  0-fixed lot size, 
                                  //  1-% from deposit, 
                                  //  2-fractional proportional, 
                                  //  3-fractional fixed lot size, 
extern int LotsPercent=0;   // % from deposit 
extern int LotsDeltaDepo=500;  // factor of deposit increase 
extern int LotsDepoForOne=500;  // deposit size for 1 mini lot 
extern int LotsMax=100; // Max number of mini lots 


double ldLot;
then some of the ea code till you get to the buy and sell part and enter in the following
Code:
ldLot = GetSizeLot();
         ticket = OrderSend(Symbol(),OP_SELL,ldLot,Bid,slippage,realSL,realTP,nameEA+" - Magic: "+magicEA+" ",magicEA,0,Red); // Sell
and then the final part at the bottom of ea code

Code:
///////////////////////////////////////////////////////////////////////////////////////
// This part is the function where the lot size is calculated

double GetSizeLot() {  
  double dLot; 
  if (LotsWayChoice==0) dLot=Lots; 

  // fixed % from deposit 
  if (LotsWayChoice==1) { 
    dLot=MathCeil(AccountFreeMargin()/10000*LotsPercent)/10; 
  } 

  // fractional proportional 
  if (LotsWayChoice==2) { 
    int k=LotsDepoForOne; 
    for (double i=2; i<=LotsMax; i++) { 
      k=k+i*LotsDeltaDepo; 
      if (k>AccountFreeMargin()) { 
        dLot=(i-1)/10; break; 
      } 
    } 
  } 

  // fractional fixed 
  if (LotsWayChoice==3) { 
    dLot=MathCeil((AccountFreeMargin()-LotsDepoForOne)/LotsDeltaDepo)/10; 
  } 

  if (dLot<0.1)  dLot=0.1;
  if (dLot>LotsMax) dLot=LotsMax;
   
  return(dLot);  
  }
I hope this is of some use to anyone.
__________________
http://www.kiwimate.info - Kiwi Cash Pro Investment
Reply With Quote