yes your sentence is fine.
In the UK on a public sign/notice it would say something like these example.
(trash garbage Is American and understood, on the street ,but not used on official notices)
"The throwing of Rubbish from windows is forbidden"
"Throwing rubbish from windows is not permitted"
"the throwing of rubbish from windows, is an offence punishable by Six months imprisonment or a fine of £50,000"
We do have very high tens of thousand of £'s fine for some offences to scare people, but in reality a judge would be required to look at a persons income, and punish accordingly. But if a company or it's workers threw rubbish from windows then the high fines would be applied.
if the sign was produced by an official department it would be much longer but the key words would be forbidden/ not permitted.