Need Help to code a simple strategy in PI

Hi ,

I need help in coding a simple strategy in PI for back testing.

its a 10 mins Breakout strategy,

1)Buy when Break days high and short when break the days low.

2)Stop loss is day’s high for short sell and day’s low for Buy.

3)1st Target is 50% difference between high and low .

and the Final Target is entire difference between high and low .

I tried it doing myself .Please look into this is that correct ?I have not tested my code yet as I need help for coding target. Please help !

For Buy,
LAST>REF(HIGH,1)

For SELL,
LAST<REF(LOW,1)

Stop Loss for BUY entry,
REF(LOW,1)

Stop Loss for SELL entry,
REF(HIGH,1)

Can any coder will help?

For the above given condition, use it in day candle time frame

Buy Script:

LAST > HIGH

Sell Script:

LAST < LOW

the stoploss you have given same conditions for buy and sell.

Hi AG,

what you mean by day candle time(EOD) ?
and the code is throwing error as script generated no trades.!!
Please help.