I want to set in IDA breakpoint when a specific value is written on the stack.
I know how to set hardware breakpoint, but I can set it only by address.
You simply cannot. There are no mechanisms by which you can break execution on a specific value write. You'll have to use any other mechanisms, probably a memory breakpoint, and a conditional check of what's at the top of the stack.