• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 9:19pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 9:19pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Which would you prefer: increasing lot size or TP size? 21 replies

Best leverage and lot size for $1000 deposit 54 replies

At what lot size/account size do you have scale issues? 35 replies

which broker allows 1000 standard lot size per order? 4 replies

Lot size, contract size, max position ? 1 reply

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 2
Attachments: Help: Need code to increase lot size per $1000 increase in account
Exit Attachments

Help: Need code to increase lot size per $1000 increase in account

  • Post #1
  • Quote
  • First Post: May 24, 2008 7:36pm May 24, 2008 7:36pm
  •  mel8331
  • | Joined Apr 2007 | Status: Member | 23 Posts
I need a code to increase my initial lot size per $1000 increase in account balance in the pattern below

Balance__________________Lot Size
1000 1000/1000 0.1 (Initial lot size)
1500 1500/1000 0.1
2000 2000/1000 0.2
2900 2900/1000 0.2
3100 3100/1000 0.3
3600 3600/1000 0.3

Can someone help show me how to code it for a mini account ?
  • Post #2
  • Quote
  • May 24, 2008 10:17pm May 24, 2008 10:17pm
  •  blueruby
  • Joined Feb 2007 | Status: Stock Broker, October 1987 | 1,299 Posts
double Thousands = AccountBalance() / 1000;
double RoundDown = MathFloor(Thousands);
double Lots = RoundDown / 10;

So if you had $2939.66 in the account, the first statement would give you 2.93966;
The next line would give you 2;
last line would give 0.2.

try it out on demo and if it doesn't work, move a decimal point.
 
 
  • Post #3
  • Quote
  • May 25, 2008 12:16am May 25, 2008 12:16am
  •  mel8331
  • | Joined Apr 2007 | Status: Member | 23 Posts
Quoting blueruby
Disliked
double Thousands = AccountBalance() / 1000;
double RoundDown = MathFloor(Thousands);
double Lots = RoundDown / 10;

So if you had $2939.66 in the account, the first statement would give you 2.93966;
The next line would give you 2;
last line would give 0.2.

try it out on demo and if it doesn't work, move a decimal point.
Ignored
I have implementing the suggestion into the EA attached but, I could not get it to work correctly when balance past the $2000 mark, can anyone help ?

Inserted Code
extern bool      MoneyManagement=true; 
...
...

int start()
 {
 
//+------------------------------------------------------------------+
//| MoneyManagement to increase "lots" & "buylots" size base on per $1K increase in balance                                          |
//+------------------------------------------------------------------+
if (MoneyManagement)    
   {
     double Thousands = AccountBalance() / 1000;
      double RoundDown = MathFloor(Thousands);
            if (RoundDown < 1) { RoundDown =1; }
//+------------------------------------------------------------------+
//Due to my limited coding skill, the problem seem to lie here as when account > $2000, code does not work properly|                                         |
//+------------------------------------------------------------------+ 
            
      lots= lots * RoundDown;
      buylots = buylots * RoundDown ;
//+------------------------------------------------------------------+
// May not be necessary if the coding of lot size is done properly                                        |
//+------------------------------------------------------------------+     
      if(lots < 0.2) { lots =0.2; }
      if(buylots < 0.19) { buylots =0.19; }
    }
    
  if(MoneyManagement==false)
   {
     lots=lots;
     buylots=buylots;
   }   
....... 
//- rest of the code
Attached File
File Type: mq4 LameMarket MMK.mq4   6 KB | 323 downloads
 
 
  • Post #4
  • Quote
  • May 25, 2008 6:30am May 25, 2008 6:30am
  •  waltini1
  • | Joined Feb 2007 | Status: Member | 157 Posts
I'm no expert, but, I think because you have a couple or return(0) in there before it gets to order send so it just keeps multiplying the lots.

I left my working out so you can follow the working out of an amateur. I use the Print function a lot in fault finding.

cheers
Attached File
File Type: mq4 LameMarket MMK.mq4   8 KB | 339 downloads
 
 
  • Post #5
  • Quote
  • Last Post: May 25, 2008 9:24am May 25, 2008 9:24am
  •  mel8331
  • | Joined Apr 2007 | Status: Member | 23 Posts
Quoting waltini1
Disliked
I'm no expert, but, I think because you have a couple or return(0) in there before it gets to order send so it just keeps multiplying the lots.

I left my working out so you can follow the working out of an amateur. I use the Print function a lot in fault finding.

cheers
Ignored
Thanks, the example do help alot.
 
 
  • Platform Tech
  • /
  • Help: Need code to increase lot size per $1000 increase in account
  • Reply to Thread
0 traders viewing now
Top of Page
Forex Factory Blog Updated: Alerting All Members
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2022