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

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

MT4 Order Plugin: Trade by lines with risk based lot sizing 1,291 replies

50 Lots and Up (Your Experience Trading Large Lots) 3 replies

How to calculate forex position sizing / lot sizing 17 replies

Optimal Position sizing based on Win/Loss ratio 15 replies

Open 4 trades for 4 lots or 1 trade for 4 lots? 5 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
Tags: Progressive lots sizing based on account balance and tracking balance
Cancel

Progressive lots sizing based on account balance and tracking balance

  • Post #1
  • Quote
  • First Post: Edited Nov 21, 2012 12:57am Nov 20, 2012 8:08pm | Edited Nov 21, 2012 12:57am
  •  Ozzie Taz
  • Joined Mar 2009 | Status: Persistant | 227 Posts
Hey guys,

Have a question about some code.
Im trying to use a progressive system only when my current account balance is below a 'high' of my account balance.

So basically i have the following:

if (equityStart < AccountBalance())
{
equityStart = AccountBalance();
}

equityStart is an initial balance i have (so its the initial 'high' of my account balance. If my account balance heads south from there then it will start the progression. If some of my following trades (im not martingaling) are successful and my account balance is higher than equityStart, then i wanted equityStart to equal the account balance then i go back to the initial lot size in the progression and stay there until my account balance decreases again. Basically only using my progression method when im in a hole.

The only thing is its not working and im not sure what code i really need to implement to have it keep track of everything.

Is there some formal way of coding the above?

cheers
Luck is where preparation meets opportunity.......
  • Post #2
  • Quote
  • Nov 20, 2012 8:50pm Nov 20, 2012 8:50pm
  •  Jack_Larkin
  • | Commercial Member | Joined Nov 2011 | 1,267 Posts
Wait, so you want to increase your risk if your account goes below the account high watermark? That's a sure way to blow cash when your strategy isn't working well and leave it on the table when the strategy is in tune with the market. Just saying.

Initial thought on your code:
Your code will only work during that one instance of the EA. If you restart it, you reset the high watermark to whatever the balance is at that time in the new instance.
FXGears.com
 
 
  • Post #3
  • Quote
  • Nov 20, 2012 9:01pm Nov 20, 2012 9:01pm
  •  Ozzie Taz
  • Joined Mar 2009 | Status: Persistant | 227 Posts
No, im not continually increasing lot sizes. Maybe progressive was an incorrect word to describe it.
I want to be able base following trades on different lot sizes in a progressive manner (progressive as in from trade 2 onwards).

The progressive trades are not always increasing in size, infact they are varying.

Thanks for the reply, i see what your saying regarding the restart. How would you recommend getting around this issue?
Luck is where preparation meets opportunity.......
 
 
  • Post #4
  • Quote
  • Last Post: Nov 20, 2012 9:43pm Nov 20, 2012 9:43pm
  •  Jack_Larkin
  • | Commercial Member | Joined Nov 2011 | 1,267 Posts
Quoting Ozzie Taz
Disliked
No, im not continually increasing lot sizes. Maybe progressive was an incorrect word to describe it.
I want to be able base following trades on different lot sizes in a progressive manner (progressive as in from trade 2 onwards).
Ignored
Still don't feel a past trade outcome should affect a future trade size (outside of risk scaling with the account balance in a linear fashion.) I mean, the outcome of a past trade has zero impact on the possible outcome of a future trade, so mixing up variance here can't, in theory, improve your returns over a large enough sample of trades.

But anyway..

Quoting Ozzie Taz
Disliked
Thanks for the reply, i see what your saying regarding the restart. How would you recommend getting around this issue?
Ignored
Perhaps store the value as a global variable instead of a variable only used by the EA? That would solve the issue with the EA re-initializing and losing past high watermarks. Heck, you should be able to even quit and restart MT4 and still retain the variable. The only problem now is, porting the EA to a new install of MT4 would start a new variable.

Other ways would be writing the value to a log file during deinit() and reading that file each time the EA starts again. That would make the value portable with the EA if you move it (plus the file) to the new MT4 instance.

(If a more seasoned programmer knows a better way, please speak up.)
FXGears.com
 
 
  • Platform Tech
  • /
  • Progressive lots sizing based on account balance and tracking balance
  • Reply to Thread
0 traders viewing now
Top of Page
  • 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 / ©2023