Regarding foreign exchange

Hi there,
Can anyone help me by explaining how foreign exchange gain/loss works and what a opening balance is? I find the whole process very confusing while creating exchange rates and it doesn’t work either. Any way to simplify the process for good order?

If we input both fields as below in a dual currency transaction (right now its optional), can Manager determine exchange rates automatically?