This question is not about ethics. It is about our perceptions of positive and negative value. I take the original meaning of the great emperor to be that we have control only of our own thinking, and can choose to see anything as positive or negative. So we can choose to be downcast or inspired, happy or sad, accepting or frustrated. Is this the will to power as Nietzsche conceived it, in the stoic rather than egoistic sense?
The quote expresses the idea of a (morally) blank or neutral world which is colored in "good" or "bad" by our thinking.
Not sure you could call that "true" or "false" as it's more of a statement of an opinion. You might for example also take the perspective that there is an absolute and objective definition of the terms "good" and "bad", that is not tied to the subjective impression of the individual.
Now sure Nietzsche seems to have taken that perspective, rejecting the classic moral supremacy of the Christian Church and afterwards finding himself confronted with moral nihilism and so took up the quest to define a new moral. Where he radically affirms the agency of the individual which needs to make up a new moral that goes beyond good and evil and instead declares what is "good" and "bad" by what is serving and hindering their own goals.
I take his meaning to be that we have control only of our own thinking, and can choose to see anything as positive or negative. So we can choose to be downcast or inspired, happy or sad, accepting or frustrated.
If you take that quote in isolation the scope of possible interpretation is pretty wide, however if you see it in it's context it seems to be more narrow: https://poemanalysis.com/shakespeare-quotes/there-is-nothing-either-good-or-bad/
So apparently Hamlet feels imprisoned within Denmark by the knowledge that the current king is the murderer of his father and that he has control over him. Despite that in reality Hamlet is free to move, he is not actually imprisoned and he is aware of that. He asserts that what imprisons himself is the feeling of his own imprisonment and that he just needs to let go of the thinking of his negative perception of the situation. Though at the end of the day it's not really his choice to make, like he cannot not process the world through the lens of his self and he cannot unknow or unfeel how he interprets things so what he wishes for is akin to insanity to literally "losing his mind".
“You have power over your mind – not outside events. Realize this, and you will find strength.”
―Marcus Aurelius, from his Meditations
Comparable, but very different in intent. In Act 2 Scene 2, Hamlet speaking continues:
"Oh, God, I could be bounded in a nutshell and count myself a king of infinite space, were it not that I have bad dreams."
Here are a few I think comparable statements to Aurelius':
"The mind is its own place, and in itself can make a heaven of hell, a hell of heaven."
-from 'Paradise Lost', by John Milton
"The Great Way is not difficult for those who have no preferences. When love and hate are both absent everything becomes clear and undisguised. Make the smallest distinction, however, and Heaven and Earth are set infinitely apart.
If you wish to see the truth then hold no opinions for or against anything. To set up what you like against what you dislike is the disease of the mind.
When the deep meaning of things is not understood the mind's essential peace is disturbed to no avail.
The Way is perfect like vast space where nothing is lacking and nothing is in excess. Indeed, it is due to our choosing to accept or reject that we do not see the true nature of things. Live neither in the entanglements of outer things, nor in inner feelings of emptiness. Be serene in the oneness of things and such erroneous views will disappear by themselves."
-from the poem Hsinhsinming, by the Third Patriarch of Zen, Seng Tsan.
"Mind precedes all mental states. Mind is their chief; they are all mind-wrought. If with an impure mind a person speaks or acts suffering follows him like the wheel that follows the foot of the ox.
Mind precedes all mental states. Mind is their chief; they are all mind-wrought. If with a pure mind a person speaks or acts happiness follows him like his never-departing shadow."
-opening lines of The Dhammapada, a collection of sayings of the Buddha Siddhartha Gautama
Aurelius and the Stoics, Milton in what has become an important Christian text, and these Buddhist texts, are talking about a spiritual recognition. Not of infinite liberty, in the way you seem to imply:
we have control only of our own thinking, and can choose to see anything as positive or negative
We don't have control of our bad dreams. We don't have control over the past: even Enlightenment in the Buddhist tradition can only liberate us from creating bad karma, not from facing the consequences of the karma we have already made. The Stoic injunction is not that you are responsible for whatever situation you find your mind in. What Aurelius is talking about is cultivation, of inner qualities like equanimity. A lot of his Meditations are subjects to think about, comparisons to be drawn in your own life. It's not intellectual ideas being declared true, but practices to engage in to come to knowledge about your own life.
What Hamlet says is not true, and it doesn't accurately represent Aurelius. And that theme is covered in Hamlet. Will he be puppeted by the ghost demanding vengeance? It's not simply a matter of his deciding to become a cheerful optimist who forgets how his father died. He must grapple with the past, and how he does so is his freedom. His freedom does not extend to changing the past, only to what work he does with his mind, which will change how and who it is that meets the future.
In spiritual terms the focus tends to be on cosmology, on how we situate ourselves towards the world, how we assemble and narrate what we know. I would draw a comparison in this to theory-making, where we can never know what better theory awaits us and there is no simple algorithm to get us to it (Popper is good on this). This should be contrasted to experimental results, to phenomena, and evidence. Our thinking cannot change that kind of knowledge, and to believe it can is the route towards propaganda and delusion. Like, dislike; love, loathe; desire, abhor; these are situational. But is having enough oxygen, enough water, enough food to live, something to simply decide how to situate ourselves towards? We need some things as prerequisites, to even have the luxury of continuing, in which to do inner work. Thinking alone cannot change that.
You know Nietzsche loathed the Stoics right?
“You desire to LIVE "according to Nature"? Oh, you noble Stoics, what fraud of words! Imagine to yourselves a being like Nature, boundlessly extravagant, boundlessly indifferent, without purpose or consideration, without pity or justice, at once fruitful and barren and uncertain: imagine to yourselves INDIFFERENCE as a power—how COULD you live in accordance with such indifference? To live—is not that just endeavouring to be otherwise than this Nature? Is not living valuing, preferring, being unjust, being limited, endeavouring to be different? And granted that your imperative, "living according to Nature," means actually the same as "living according to life"—how could you do DIFFERENTLY? Why should you make a principle out of what you yourselves are, and must be? In reality, however, it is quite otherwise with you: while you pretend to read with rapture the canon of your law in Nature, you want something quite the contrary, you extraordinary stage-players and self-deluders! In your pride you wish to dictate your morals and ideals to Nature, to Nature herself, and to incorporate them therein"
-from Beyond Good and Evil
You might like this answer on what Will To Power means: What was Nietzsche all implying-and-not-implying by what would make him "holy"? The TLDR is that it's about shifting from fitting ourselves into a metanarrative recieved from society, towards a rich inner life that generates a narrative that enriches the lives of others and draws them into it, in the direction of 'lifeliness' which is not just of power, but of laughter, of dancing:
"And we should consider every day lost on which we have not danced at least once. And we should call every truth false which was not accompanied by at least one laugh."
-from Thus Spake Zarathustra
And, of not turning away from tragedy, if that is part of the best story.
"Man is no longer an artist, he has become a work of art."
―Nietzsche, from The Birth of Tragedy
Answer is quite simple, What Shakespeare said was fact. Good and Bad are relative terms. Nor there is universal measure of good or bad. They are result of our comparison or analysis, which is at the end act of thought. If you ask what Nietzsche said was same or not, my answer would be no. Reason being I don't find comparison of them would be worth it. Since they belonged from different times and also there interests were different, comparison will create unnecessary trouble.