Courtesy Flag
It is customary, but not obligatory, when visiting the waters of another country, to fly from the senior signaling position, the maritime ensign of that country as a mark of courtesy.
That said you may come unstuck in some countries if your courtesy flag is tatty, too small or not there at all, as the courtesy flag acknowledges that you are in that country’s territorial waters. NB In some instances – such as the UK – the maritime ensign is not identical to the national flag.
The courtesy flag should be flown as a signal. On a single masted yacht the correct position is as the upper most flag at the starboard crosstrees.
If a motor cruiser does not have a dedicated signal halyard, a prominent position such as the VHF aerial is commonly used as a substitute.