I need to implement the Candelier Exit in my trading strategy in PRT, but fail to understand how to code it. The rules are quite simple:
If Long entry:
- Set Current Exit to entry price – Factor x Average True Range (of period x)
- Store the intitial risk R as Factor x Average True Range (of period x)
When Long, update exit:
- New Exit= Highest high since entry – Factor x Average True Range (of period x)
- If New Exit>Current Exit then Current Exit=New Exit
When Long, exit next bar (day) if
- Close<Current Exit
- Close-Entry Price >=4 * R
If Short entry:
- Set Current Exit to entry price + Factor x Average True Range (of period x)
- Store the intitial risk R as Factor x Average True Range (of period x)
When Short, update exit:
- New Exit= Lowest low since entry + Factor x Average True Range (of period x)
- If New Exit<Current Exit then Current Exit=New Exit
When Short, exit next bar (day) if:
- Close>Current Exit
- Entry Price – Close >=4 * R
I’d appreciate any thoughts about this.