Help me Code This Strategy for Buy Sell Decisions

Buy Level = L+[ 0.5 * (H-L)]
Buy Stoploss = L+[ 0.1 * (H-L)]
Buy Target = L+[ 1.0 * (H-L)]

Sell Level = H-[ 0.5 * (H-L)]
Sell Stoploss = H-[ 0.1 * (H-L)]
Sell Target = H-[ 1.0 * (H-L)]

Where
H = Highest of Previous Day High and Current Day High
L = Lowest of Previous Day Low and Current Day Low

Buy Script:

REF(LOW,1)+(0.5*(HIGH-LOW))

Buy StopLoss:

REF(LOW,1)+(0.1*(HIGH-LOW))

Exit Buy:

REF(LOW,1)+(1.0*(HIGH-LOW))

Sell Script:

REF(HIGH,1)-(0.5*(HIGH-LOW))

Sell StopLoss:

REF(HIGH,1)-(0.1*(HIGH-LOW)

Exit Sell:

REF(HIGH,1)-(1.0*(HIGH-LOW))

You have to select Time frame as day charts and kindly note that as you have not mentioned which high is for which day so  , here i have taken like   REF(HIGH,1) means high of previous day and just HIGH means high of present day.