multiple mini lots

 

Hi all, bit of a small problem here.

basically what i am trying to do is open up say 1.3 lots in an ea. it's mad easy to do 1.0 or .1 or 0.1 or whatever but for some reason i can't figure out how to get 1.3. is there some sort of loop i should go through in order to keep opening individual orders until the lot size reaches a total of 1.3 or what? any help would be greatly appreciated thank you very much!

 
You can just supply 1.3 as the lot size. If it is giving you an error, what is the error number?
 
blogzr3:
You can just supply 1.3 as the lot size. If it is giving you an error, what is the error number?

no error, it just won't open the trade inexplicably =\

 
blogzr3:
You can just supply 1.3 as the lot size. If it is giving you an error, what is the error number?

here's the code maybe it will help clear some things up. thanks for your help btw, i appreciate it a great deal.


int start()

{

int

aud,

nzd,

unitsaudusd = 10000,

finalunits,

quotehome = 1;

string

audusd = "AUDUSD",

nzdusd = "NZDUSD";

double

audusdask = MarketInfo("AUDUSD",MODE_ASK),

audusdp = MarketInfo("AUDUSD",MODE_POINT),

nzdusdbid = MarketInfo("NZDUSD",MODE_BID),

nzdusdp = MarketInfo("NZDUSD",MODE_POINT),

audusdbbu = iBands("AUDUSD",PERIOD_H4,20,2,0,PRICE_LOW,MODE_UPPER,0),

audusdbbl = iBands("AUDUSD",PERIOD_H4,20,2,0,PRICE_LOW,MODE_LOWER,0),

nzdusdbbu = iBands("NZDUSD",PERIOD_H4,20,2,0,PRICE_LOW,MODE_UPPER,0),

nzdusdbbl = iBands("NZDUSD",PERIOD_H4,20,2,0,PRICE_LOW,MODE_LOWER,0),

audusdbbdiff,

nzdusdbbdiff,

closingrateaudusd,

closingratenzdusd,

openingrateaudusd = MarketInfo("AUDUSD",MODE_POINT),

openingratenzdusd = MarketInfo("NZDUSD",MODE_POINT),

estimatedprofitaudusd,

estimatedprofitnzdusd,

unitsnzdusd,

nzdusdunits;

audusdbbdiff = audusdbbu - audusdbbl;

nzdusdbbdiff = nzdusdbbu - nzdusdbbl;

closingrateaudusd = openingrateaudusd + audusdbbdiff;

closingratenzdusd = openingratenzdusd + nzdusdbbdiff;

estimatedprofitaudusd = (closingrateaudusd - openingrateaudusd)*(quotehome)*unitsaudusd;

unitsnzdusd = ((closingrateaudusd - openingrateaudusd)*unitsaudusd)/(closingratenzdusd - openingratenzdusd);

nzdusdunits = unitsnzdusd/10000;

finalunits = NormalizeDouble(nzdusdunits,1);

nzd = OrderSend(nzdusd,OP_SELL,finalunits,3,0,0,"",MAGICMA2,0,Red);

aud = OrderSend(audusd,OP_BUY,1.0,audusdask,3,0,0,"",MAGICMA1,0,Green);

return(0);

}

 

Your price of "3" in the OrderSend doesn't look right for starters, unless NZDUSD has drastically changed since I last looked ;)


Add more Print() statements, so you can narrow down the problem like so, and look in the Experts Tab for those outputs:

Print("finalunits=",finalunits);

nzd = OrderSend(nzdusd,OP_SELL,finalunits,3,0,0,"",MAGICMA2,0,Red);

if (nzd<0) Print("OrderSend error# for nzd is here: ",GetLastError());

 
blogzr3:

Your price of "3" in the OrderSend doesn't look right for starters, unless NZDUSD has drastically changed since I last looked ;)


Add more Print() statements, so you can narrow down the problem like so, and look in the Experts Tab for those outputs:


ah i see the problem, there's no nzdusdask, thanks for the help!