Jump to content

help me with account balance protection lock


suryadi

Recommended Posts

i hope senior here can help me...i want to protect lock account balnce with percent..and if i have open order more than 7...

for example..if i want to protect 50% of my account balance..before i use this code...

 

double ld_64 = AccountBalance() * ProtectionPercentage / 100.0;

if (ProtectionPercentage > 0.0) {

if (AccountEquity() <= ld_64) {

CloseAll();

return (0);

}

}

in backtest look no problem...

when in real trade and re-quote situation this code can not work perfect..

because always can not close all my open orders..and i lost more than protection..

can senior here help me to code..the lock function for this?

if still have floting lost orders protection value used Percentage of last account balance...

until all lost orders have closed...than protection value will change follow the remaining account balance...

in other word update protection value just in 2 situation:

1.if account balance was grow...

2.if in lost situation..protection value will used the last highest account balance...until all lost orders closed..

than update protection value after that.

 

thank you.....

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...