Discipline is a very important factor to be successful in stock market trading. No knowledge will work for you to be profitable if you don't follow discipline. Here are some tips to build discipline:
1) Maintain a trading journal and record all your trades with reasons and track it at regular intervals to know your mistakes and then improve.
2) Stick strictly to your setup and don't take trades randomly.
3) Use proper stop loss and never trade without setting it as it can lead to huge losses.
4) You need to accept that profit and losses are both part of trading, proper risk management makes you profitable.