I want to use multiples of Average True Range as a stop loss and limit
I tried below, with ‘D’ variable for ATR periods, and’E’ & ‘F’ variables for multiplication of ATR, not working.
// Stops and targets
SET STOP pLOSS (AVERAGETRUERANGE[D](CLOSE))*E
SET TARGET pPROFIT (AVERAGETRUERANGE[D](CLOSE))*F
Any ideas?
Thank you.
MODERATORS EDIT: Code tidied up. Please always use the ‘Insert PRT Code’ button when posting code.
ATR does not return pips, so you should remove “p” and use just LOSS and PROFIT.
Bear in mind that using these function in the code will continuously adapt the Takeprofit and Stoploss on each variation of the ATR. You should enclose these instructions into the condition that trigger the order.