18 years is quite an advanced age for a cockatiel. While some live into their mid to late 20s, it is really quite rare.
Of course taking her to a vet immediately is a very good idea since she could have a virus or bacterial infection. However, it is very likely simply old age that is causing her body to begin failing. But I do encourage her to get to the vet if at all possible immediately. If she has an infection or virus, the right medication could provide her with several more years of quality life.
Because she is sitting in the cage bottom a lot, you want to give her some extra heat there by placing a heating pad under about 1/2 of the cage bottom. Try to get the temperature in the bottom of the cage to about 85 degrees to help her save her energy since parrots utilize a great deal of energy just keeping up their body temperature which is much higher than our normal body temperature.
If you have a grate in the cage bottom, consider placing a soft cloth, but one that is not "nubby", one that will not catch her nails, in the bottom for her to snuggle into. Sometimes a cockatiel will feel secure and cozy in such a snuggle spot.
Be sure she has food and water available on the cage bottom so she does not need to move far to get to it. Give her all her favorite foods. Eating is so important to keeping up her strength.
If she is tame, you'll want to spend as much time as possible snuggling with her. You can place her on your chest, against your skin and let your body heat warm her. If she will allow it, cover her with a soft cloth and tickle her head and crest feathers. Let her know in every way possible that she is loved very much.
Let her sleep quietly all she wants to. This could be a sign of illness but in a bird of her advanced years, she may be just conserving strength.
Again, I strong encourage a vet visit to a good avian vet to see if she has an illness that she can recover from with the proper medication. Please, however, be ready to accept that old age may be the only problem she is having. 18 really is quite elderly for a cockatiel and depending on her diet throughout her life and many other factors, she may be nearing the end of her days.
I know that you will want to spend every minute with her possible. Let her know she is loved and I know she will let you know she loves you.
When a pet advances in age to the point that their life span is ending, it is a very sad and difficult time for the parrot owner. Our parrots are family members and just like a child so the loss of a dear bundle of feathers is sad. If age does turn out to be her problem, take comfort in knowing that she has enjoyed a quality life with you.
It is not unusual for an elderly cockatiel nearing the end of her days to live quite a few days longer when provided with the extra heat support and fed whatever food she will accept. Unless you feel she is in pain or suffering, do not let the vet talk you into putting her to sleep. If she is comfortable at home with you, there is no reason not to be with her, giving her love and support until the very end.
I do hope the vet finds a treatable infection so your beloved cockatiel can recover and be with you for many more joyful months. If, however, old age is taking her away, I hope she goes peacefully and quietly while snuggled in your loving arms.