Forex
Google

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-23-2005, 09:21 AM
hellkas hellkas is offline
Senior Member
 
Join Date: Oct 2005
Location: Porto/Portugal
Posts: 250
hellkas is on a distinguished road
Change Lots

Hi all...

What I've to do to change lots?

PHP Code:
int LotCalc(double Risk)
  {
   
int vLots=0;
   if (
UsePct >&& Risk>0vLots=MathFloor(AccountBalance()*(UsePct/100)/((Risk/MarketInfo (Symbol(), MODE_POINT))*10));
   if (
UsePct >&& Risk==0)  vLots MathFloor(AccountBalance()*(UsePct/100)/1000);
   if (
vLots>MaxLotsvLots=MaxLots;
   if (
vLots<1vLots=1;
   return(
vLots);

I already changed for 0.1 but the EA dont trade..
But if I change for 2 lots it trade normally..

Any help I appreciate..

Tks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-27-2005, 03:14 PM
trevman trevman is offline
Senior Member
 
Join Date: Dec 2005
Posts: 142
trevman is on a distinguished road
that looks overly complicated, heres what i use

Code:
   double lots = NormalizeDouble(AccountFreeMargin()/(500/0.1),1);
this uses 0.1 lot for every 500 in your account, adjust them as you see fit. hope this helps.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-30-2005, 10:09 AM
hellkas hellkas is offline
Senior Member
 
Join Date: Oct 2005
Location: Porto/Portugal
Posts: 250
hellkas is on a distinguished road
Quote:
Originally Posted by trevman
that looks overly complicated, heres what i use

Code:
   double lots = NormalizeDouble(AccountFreeMargin()/(500/0.1),1);
this uses 0.1 lot for every 500 in your account, adjust them as you see fit. hope this helps.

hi trevman...

Thanks for your help but dont result..

Do you've other way? Anyone?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-30-2005, 11:15 AM
zuhainis zuhainis is offline
Member
 
Join Date: Dec 2005
Posts: 32
zuhainis is on a distinguished road
I think your problem is here:

if (vLots<1) vLots=1;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 12-30-2005, 06:01 PM
hellkas hellkas is offline
Senior Member
 
Join Date: Oct 2005
Location: Porto/Portugal
Posts: 250
hellkas is on a distinguished road
Quote:
Originally Posted by zuhainis
I think your problem is here:

if (vLots<1) vLots=1;
hi zuhainis...
Thanks for your reply

I already changed
PHP Code:
if (vLots<1vLots=1
to
PHP Code:
if (vLots<0.1vLots=0.1
but dont trade
error message: EURUSD,H1: invalid lots number for OrderSend function

What i've to do now?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 10-08-2006, 06:11 PM
ScottB ScottB is offline
Junior Member
 
Join Date: Jul 2006
Location: North Carolina, US
Posts: 7
ScottB is on a distinguished road
Change lots

My guess is that you are returning an int instead of a double (the lots parameter is a double). Anything less than 1.0 will be truncated and end up as zero (trust me, I have done it and looked for hours until I found the problem).

I hope this helps, good luck.
Scott
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lots of $$ and lots of potential... dukeofdents Suggestions for Trading Systems 5 04-08-2007 02:19 AM
Increase or Decrease lots nomz Questions 1 06-09-2006 11:07 AM
How i calculate lots? DooMGuarD Questions 4 05-29-2006 09:12 PM
Multi-Lots Eric Expert Advisors - Metatrader 4 14 03-31-2006 11:05 PM
Increasing lots with EA Willis11of12 Metatrader 4 1 03-28-2006 01:23 PM


All times are GMT. The time now is 09:20 AM.