Trade script code for this

I want to buy option once the premium crosses 30rs. How to code this tradescript. I dont want any alert or order management ideas. I want it to work as EA, and order pop up should come. Please dont suggest alternatives.

As per the above query check Price Alert Indicator

https://zerodha.com/expert-advisors/code/price-alert-indicator

Can we Write a EA(alerts) to buy at market price of particular scrip at a specified time and sell if hits 20% low form the buy price (stop loss kind of thing). I read other post this is not possible in tradescript, is it possible in afl. Or do we have any order management software for this which interacts with PI or nest trader to do this.