To prepare the crust, mix the dry ingredients (flour, sugar and salt). Add the margarine or coconut oil and mix with a dough cutter or spatula (do not use your hands, it is important to prevent the margarine or oil from melting) until you get a sandy consistency. Mixing consists of chopping the coconut oil with the cutter and integrate it with the rest of the ingredients.
Add cold water tablespoon by tablespoon and continue to integrate with the spatula. Generally 5 tablespoons is enough, but depending on the weather and humidity levels, you may need a little more. The amount of water will be enough when the flour starts clumping up together. Once you reach this point, use your hand and squeeze the lumps to integrate the dough (without kneading).
Form a ball, cover it with plastic wrap or put it in a plastic bag and place in the freezer for 1 hour.
Remove the dough from the freezer and roll it out (it should not be about 3 mm thick), if you prefer you can stretch it between 2 pieces of parchment paper. Place it on a pie pan (preferably greased or non-stick) and press down to the bottom and sides.
With a knife, cut the excess dough on the edges (you can use the excess dough to make empanadas or store it in the freezer for later use).
Pierce the bottom of the crust with a fork and place in the freezer for 30 minutes.
Preheat the oven to 375°F (190°C) 15 minutes before removing the crust from the freezer.
Remove the crust from the freezer and place a piece of parchment paper on top. Add around 3 cups of dry beans (or any other dried legumes, or ceramic beans for baking) and place in the preheated oven for 15 minutes. This is called blind baking, where basically the crust is pre-baked and with the weight of what we put on top, the dough bakes evenly without shrinking. In addition, we prevent the crust from being undercooked.
To prepare the filling, blend all the ingredients until you get a homogeneous mixture without lumps. Reserve.
Remove the crust from the oven, remove the paper with the beans and bake for another 15 minutes.
Remove the crust from the oven and pour in the filling.
Lower the oven temperature to 345°F (174°C) and bake for 1 hour (don't forget to make sure the edges are not over-browning (if that happens, place aluminum foil on top of them to protect them from receiving direct heat).
Turn off the oven (without opening it) and leave the pie inside for 10 more minutes.
Remove the pie from the oven and let it cool completely. Refrigerate for a minimum of 5 hours (or preferably overnight) so that the texture is firmer and the flavors intensify.