- ago
Hi, I am using both 6.9 and 7

In 6.9 I had the option of testing using Max risk percent position sizing (with ATR sizing in the code) - but with a non compounding option, see screen shot

Is this option available in 7 or 8? I can't seem to find a way of testing using ATR sizing to give a non compounding result.

Thanks Peter Castle
0
1,388
Solved
6 Replies

Reply

Bookmark

Sort
- ago
#1
Hi Peter,

You will not find it in WL7, this option was added to WL8 in B11 (https://www.wealth-lab.com/Software/ChangeLog):

* Added new Max Risk Percent Position Sizing option.
* Default Max Risk Stop Level is controlled by an Indicator defined in Trading Preferences, default if MathIndOpValue, 10% below the Low price.
* Override GetMaxRiskStopLevel to set a specific initial stop loss level that will be used instead of the default Indicator.
* Trading Preferences also contains options allowing you to have the Backtester automatically generate exit orders, and whether the exit order stop level is static. Dynamic Max Risk Stops are generated in a "trailing stop" manner.


Check out this build highlights video for an overview of the feature: https://www.youtube.com/watch?v=xkzJZuYei_o&t=10s

P.S. Topic title made more clear: "Position sizing" => "Max risk percent position sizing in WL7"
0
Best Answer
fred99998
 ( 19.59% )
- ago
#2
Is it possible to use some indicator to make the risk not only 1*ATR, but also any other number, for example, 2*ATR or 1.5*ATR?
Something like this:

0
- ago
#3
In such cases you could create a Custom Indicator for the multiple of ATR (note: usable when WL8 is started with elevated privileges i.e. as admin).
0
- ago
#4
Can you please provide some example code for doing this?

Override GetMaxRiskStopLevel to set a specific initial stop loss level that will be used instead of the default Indicator.

I'd like to use a custom trailing stop timeseries instead of the default.

Saw this approach mentioned here but could use some sample code -
https://www.wealth-lab.com/Discussion/Max-risk-percent-position-sizing-in-WL7-8544

Thanks!
0
- ago
#5
QUOTE:
Can you please provide some example code for doing this?

Actually, it's very simple. As says the QuickRef, you override the method and return a double value which is the value of your TimeSeries at idx. I'm going to add this example code to the QuickRef:
CODE:
public override double GetMaxRiskStopLevel(BarHistory bars, PositionType pt, int idx) {          double atr = ATR.Series(bars, 14)[idx] * 1.5;          double stop = (pt == PositionType.Long) ? bars.Low[idx] - atr : bars.High[idx] + atr; return stop; }
1
- ago
#6
QUOTE:
Is it possible to use some indicator to make the risk not only 1*ATR, but also any other number, for example, 2*ATR or 1.5*ATR?
Something like this:


Re: @fred9999's question from Post #2. Yes, it's possible now using B81:

https://www.wealth-lab.com/Software/ChangeLog
* You can now optimize indicator parameters down to any arbitrary depth in Building Block Strategies.

0

Reply

Bookmark

Sort