Cost of trade calculations

 

Good day,


So, I've been trying to figure out how much money a trade would need to stay open, even if the price hit zero. This is what I came up with:

Lot_Required_Margin = MarketInfo(Symbol(),MODE_MARGINREQUIRED);
Required_Margin = (Lot_Required_Margin*Lot_size);

AvailableBalance = AccountBalance();
while(OrderSelect(i, SELECT_BY_POS)==true){
if(OrderSelect(i, SELECT_BY_POS)==true){
AvailableBalance = (AvailableBalance - ((OrderOpenPrice()*1.10)+Required_Margin));
}

i++;

}



The idea is it would take the open price of the order, add 10% to it then add the margin required to open the trade. Once this is done, subtract that from the balance. The money left over will be divided with the same ((OrderOpenPrice()*1.10)+Required_Margin)), this will tell how many trades it can afford to open. Any help would be great.


Thanks
 

"So, I've been trying to figure out how much money a trade would need to stay open, even if the price hit zero"

Assuming you are long, you will need margin deposit to cover the unrealized loss, which could be, shall we say, substantial.

GBP, one lot long at 2.0000, and it goes to zero = -20000 pips = $200,000 loss.

Reason: