Strategy modification in pine script

Job ID: 38971308

Budget: ₹1,500 – ₹12,500 INR

I have a strategy which i use for auto trading, it works continuously , if a long entry comes , it will trade in long until any short arises, if short entry comes , it exits long and enters short immediately. I want to enable pyrammiding function on my algo , but i want different alerts for pyrammiding , for examplae, if i set pyrammidng to 3, then consider that stock is going up , so it buys 1 quantity , then again 1 , then again 1 , so now it has 3 lots , but when short trade comes immedietly , it exit 3 lots and enters 1 lot of short position , so i need you to do such modifications in alerts and {quantity} parameters.
Related categories: Pine Script Trading