Trade script for ohlc logic help for pi scanner

Hello Algo Geek can you please help in giving tradescript code for Pi alert and scan for BUY SCRIPT SELL SCRIPT EXIT LONG EXIT SHORT
Logic:
low price = A, open price = B, high price = C
B-A=D
B-C=E
IF D<E generate a Buy call
IF D<E generate a Sell call

IF {(B-(B=C)-1} generate Exit long and generate Sell Call
IF {(B+(B=A)+1} generate Exit Short and generate Buy Call

IF {B+(B0.75)} generate Exit long
IF {B-(B
0.75)} generate Exit Short

It is not possible to define and code above given if else conditions in tradescript for option to use in pi scanner

buy: (OPEN - LOW) < (OPEN - HIGH) {buy and sell are the same?}

the exit and generate conditions are unclear. please elaborate.

cannot code the exit signals as pi doesn’t have the option to save the buy/sell price IMHO.

Hello Sir,

I am new to creating scanner, can you suggest a tutorial for using Zerodha PI scanner so that i can understand and navigate well and create my own scanners. Any advise will be great.

Regards,
Saurabh