I’ve performed an istikhara to see if I should recite Ziyarat Ashura for 40 days to ask Allah to grant me a wish. I’ve performed it around 3 or 4 times (some time passed between each of them) and the result was not good for all of them.

1) I would like to know if my istikharas were valid in those cases, and if I can repeat it after some time with the same intention (reciting Ziyarat Ashura for granting a need)?

2) If the istikharas in fact were valid, is it wrong if I act against them and recite Ziyarat Ashura for my need to be granted?

It is not right to do Istekhara for ibadaat and ziyaraat
It is a recommended act one can do for wishes but at the same time just in the love of Imam Husain as
I suggest you to recite ziyarate ashura just qurbatan ilallah in love of Imam Husain as which is greatest goodness inshallah Allah will fulfil your hajaat .
Now one more thing there are stages for anything first use your intellect Think and decide , if it is hard to understand then seek advice and suggestion from experts and wise people if still unsure then finally go for Istekhara .
Please if you did Istekhara for one thing and it was not good kindly do not repeat for same cause with same intention.