You don't say who states "the ending of a tragedy creates a sense of hope" - sounds a little like a paraphrase of Arthur Miller.I think you need to explore a little what might be meant by 'hope'.
Dramatic tragedies, whether or not they follow the Aristotelian model of a hero whose misfortunes are caused by either a great error or a great frailty, tend to show us calamitous events and an unhappy but meaningful ending. Shakespeare's tragedies - and he accepted Aristotle's model only up to a point - are almost always quirky and ambiguous, and although there are those endings which could be said to inspire hope of a kind, at least in the sense of justice restored - the reconciliation of the Montagues and the Capulets, for example, or the triumph of Macduff and Malcolm (and thus Scotland) - there is much in the ending of Hamlet to cause us only an ironic sense of hope in restored justice and order.
There is so much disorder in this play - Hamlet's madness, feigned and actual, his meeting with the Ghost, and his mistrust that it is diabolical, the technical incest of his mother and his uncle, and Claudius's culpability for his father's death (not just assassination but regicide, and the murder of a brother - two very resonant, very serious crimes against God in the context of the play and the time in which it was written) - the list is almost endless - that any ending to this play would have to produce some sort of order, or re-ordering, and it does. But restoration of real justice and a cause for hope? Claudius the murderer is dead, but although he might have been a bad man, he was not necessarily a bad king, and he dies along with Laertes, who is headstrong but almost blameless. Hamlet and Laertes forgive each other before they die, which is poignant, possibly heartening. Hamlet is given a hero-prince's death-rites, and Horatio chooses to live to tell Hamlet's tale, but although Horatio has been established as 'truthful', he is also shown to be weak... There is a sense in which this story is circular - Horatio will, we can assume, tell the tale we have just seen.
Hopeless, in the nihilistic sense of nothing matters anyway (you might consult scholarly essays on King Lear for this) Hamlet is not, but I would argue it is far too ambiguous throughout, including its ending, to leave us with anything more than a fragile sense of 'hope': we have a new order and, given that almost everyone is dead, a clean slate. But Fortinbras is a thug, who has devastated Poland and now usurps the Danish throne, and to whom it cannot matter if Hamlet is eulogised as a hero or not.
If you use this response in your own work, it must be cited as an expert answer from eNotes. All expert answers on eNotes are indexed by Google and other search engines. Your teacher will easily be able to find this answer if you claim it as your own.