purchasing eurusd with dollars

 
my expert was : Your checking is incorrect. Note that your deposit figured in dollars, but EURUSD lot is in euro
where in usa I thought if you deposit was in usd, then your purchases would be in usd.. however I must be wrong... so should I multiply my 1000*Point*Lots to calculate the cost of each lot?
 
so he said:
PAIRS ending with USD
Factor = SPot ie AUDUSD , spot would be .7550
So each AUDUSD margin would be $755

so, substituting his SPot with Point, then I would be ok.
1000*1.2750*1lot = 1275 to purchase one lot of eur/usd with dollars.
 
Dollars needed to trade a lot:

double lotsize=1.0; this is number of lots you want to trade 1,2,0.5 etc.

double dollars=MarketInfo(symbol,MODE_LOTSIZE)/AccountLeverage()*lotsize;
if(AccountCurrency()!=StringSubstr(symbol,0,StringLen(AccountCurrency()))
{
if(you want to buy)
dollars*=Ask;
if(you want to sell)
dollars*=Bid;
}

of course you may slip a couple of points so it's not exact.
 
so in the above example, i would have: (for eurusd)
dollars =100000/100*1 =1000 dollars per lot. ok, if that is correct, then 1 lot would cost 1000 usdollars..
so I take the present Ask which is 1.2687 and multiply that times 1000 = 1268. 70 which is what I must have in dollars in order to purchase a 1 lot of eurusd. .. is that correct?
if so, and I am working in eurusd only, could I say ...
if (lots * 1000 * Ask) < accountfreemargin then i can buy (1 lot * 1000 *1.2687= 1268.70 margin required)
and
if(lots*1000*Bid) < accountfreemargin then i can sell (1 lot * 1000*1. 2685=1268. 50 required

or just to simplify the whole thing, take a little chance and go on ask only.
so
if(lots*1000*Ask) < accountfreemargin... do buy or sell
 
You can verify that,

just go ahead and buy one lot on demo account and compare this equation to a margin actually taken from the account. You will multiply by open price.

It is also better to use mq4 variables and setup a function for required margin calculation:

double MarginRequired(double lots); // returns dollars required

This way if somehow your borker changes leverage your calculation will still be correct, or you move your account to a new broker with different leverage.