Comment on Managing your Script
You can’t set the condition based on your buy price. Trade script will throw an error if you set such a condition. You can define the price & generate alerts using the price alert indicator.
https://zerodha.com/expert-advisors/code/price-alert-indicator