I'm trying to build an automated forex trading system and I'm trying to understand how to calculate the number of units I should specify for each trade in different scenarios. Say for example I have an account with a broker in USD and I've deposited $1000. Ignoring leverage, I'd like to allocate my entire balance in each of the following scenarios. In each scenario I've tried to explain how I think the calculation should be performed..
Going Long
Long USD/JPY
Buy USD, sell JPY
USD is the base currency so units (USD) = 1000
Long EUR/USD
Buy EUR, sell USD
units (EUR) = 1000 / [EUR/USD].Ask
Long EUR/JPY
Buy euros, sell yen
How many yen can we get with 1000 dollars?
Buy yen with dollars
Instrument = USD/JPY
USD (selling) is the base currency so multiply by the bid
So yen = 1000 * [USD/JPY].Bid
units (EUR) = yen * [EUR/JPY].Ask
Update:
units (EUR) = yen / [EUR/JPY].Ask
Long GBP/NZD
Buy GBP, sell NZD
How many NZD can we get with 1000 USD
Instrument = NZD/USD
USD (selling) is the quote currency so divide by the ask
So NZD = 1000 / [NZD/USD].Ask
units (GBP) = NZD / [GBP/NZD].Ask
Going Short
Short USD/JPY
Sell dollars for yen
units (USD) = 1000
Short EUR/USD
Sell euros, buy dollars
units (EUR) = 1000 * [EUR/USD].Ask
Update:
units (EUR) = 1000 / [EUR/USD].Bid
Short EUR/JPY
Sell euros, buy yen
How many euros can I buy with 1000 dollars?
Instrument EUR/USD
USD (selling) is the quote currency so divide by the ask
units (EUR) = 1000 / [EUR/USD].Ask
Short CHF/JPY
Sell CHF and hold JPY
How much CHF can we buy with 1000 USD?
Instrument = USD/CHF
USD (selling) is the base currency to multiply by the bid
units (CHF) = 1000 * [USD/CHF].Bid
So the question is - have I got the logic right in each scenario?
[ This is a follow up question to my previous question - Calculating units in a cross currency short trade ]