Pinescript code - trailing stop and position sizer.
Budget: $30 – $250 AUD
I have a script that gives me my entry and I currently use a Fixed SL & TP using the ATR function.
I would like the following 2 elements:-
- be able to set an initial stop loss, as done at the moment, then use a trailing stop based on the lowest low in last x bars, combined with a fixed TP at x * ATR from the entry. So iether the fixed TP will be hit, or the trailing stop loss, and then the other one is obviously cancelled.
- I would like to test this type of trailing stop loss against a trailing stop loss based on an ATR level, so the initial stop loss is set, then the stop is moved up based on a certain ATR level below the close of each bar.
- I also need a script that calculates position size based on % of capital and stop loss, and works for all major currency pairs - I currently have a spreadsheet that does this job.
Thanks
I would like the following 2 elements:-
- be able to set an initial stop loss, as done at the moment, then use a trailing stop based on the lowest low in last x bars, combined with a fixed TP at x * ATR from the entry. So iether the fixed TP will be hit, or the trailing stop loss, and then the other one is obviously cancelled.
- I would like to test this type of trailing stop loss against a trailing stop loss based on an ATR level, so the initial stop loss is set, then the stop is moved up based on a certain ATR level below the close of each bar.
- I also need a script that calculates position size based on % of capital and stop loss, and works for all major currency pairs - I currently have a spreadsheet that does this job.
Thanks