Hallo, i am expirienced TS user but new to wealth lab.
I would like to create simple rule based strategy, entry on HH of 100days and reverse on LL of 100days. In position sizing i am using risk of 10 000USD but it seems that the strategy is risking much less than it should be.
I would be happy about any help specially about how to create a strategy which is reversing inside one bar, and some more info about how to use the position size to be sure that if am long my stop is on LL of 100days and i will risk 10 000USD.
Thanks for any help for novice.
Size:
Color:
Hi,
QUOTE:
i am using risk of 10 000USD but it seems that the strategy is risking much less than it should be.
How did you determine that? "Seems" is too vague. Be specific please.
QUOTE:
reversing inside one bar
It can be natural in TS since 'looking inside' the bar is integrated. In WL though, one has to make extra steps in coding that in a strategy so it could be implemented properly. The problem here is to determine which order should be executed first, otherwise it's easy to fall into a serious peeking error. Assuming you're backtesting on Daily data and have intraday data available for the symbol, our Community Components extension has means to do it either by looking into a lower time frame data or by estimating which stop/limit order will realistically be hit first:
Setting Priority for AtStop/AtLimit Orders
Size:
Color:
Hmmm, i have to compare the position size issue first to give some more details.
About reversing: i think which trade should be the first shouldnt be a issue here. If i am long and lowest low of some days is reached go short. This should be the same moment. As LL is reached exit long and go short. Actually this is a stop order.
Of course i would like to use onle rule based strategy.
Thanks.
Size:
Color:
QUOTE:
About reversing: i think which trade should be the first shouldnt be a issue here.
You're right, I took the statement somewhat out of context and was thinking about the problem of same bar entry/exit using stop/limit order.
Stop-and-reverse should not be a problem of course. See this FAQ for more:
How to create a stop-and-reverse system in a Rule-based Strategy?
Size:
Color:
Ok, thats the problem: if i check the "Multiple open positions allowed" my strategy is opening new and new positions as new highs are made.
And should i exit the long position and after go short or it is possible to reverse the position only with one rule? Can u give me an example?
I would also like to know how to position sizing is working. If my strategy is long on HH and is exiting at LL and i am risking 5000 usd, the position sizer is calculating the difference between HH and LL at entry point and calculating the shares amount according to my risked money?
Thanks.
Size:
Color:
QUOTE:
Can u give me an example?
We are used to work with code since it's not possible to express everything via rules. It would much easier for me to show you a readymade strategy code example. This one's reversing according to your rules:
CODE:
Please log in to see this code.
QUOTE:
If my strategy is long on HH and is exiting at LL and i am risking 5000 usd, the position sizer is calculating the difference between HH and LL at entry point and calculating the shares amount according to my risked money?
This is called the "Max Percent Risk" position sizing. For it to work, I added
RiskStopLevel directives to the code (hit F11 and start typing the first letters of the word in the QuickRef window to view the method's quick reference). So if you select "Max Percent Risk" in Wealth-Lab's Position Sizing dialog, trades will be sized exactly like you described.
For more details check out the User Guide (Help menu), then Reference > Data Panel > Position Size Control > Portfolio Simulation Mode >
Max Percent Risk.
Size:
Color:
Thanks a lot, i will play with the example code to see if i ll get what i need.
I would also like to know how can i add futures as data to WL. Any useful links? Or is it possible to export futures continuous contracts from TS to WL?
Thanks once again. M.
Size:
Color:
QUOTE:
I would also like to know how can i add futures as data to WL.
Check out the Extensions section > Providers. Customers (not free trial users) can install several providers which support futures data one way or another: IQFeed (static & streaming, subscription required),
TradingBlox or PiTrading (free EOD futures data), Bloomberg Static (static, subscription required). There are some 3rd party unsupported providers too: Multi Quote Server, Taipan EOD, and COTCollector (COT series).
And of course you can import futures data from plain ASCII files.
Size:
Color:
Thanks the code is working fine exactly as i imagine it. :-).
Any idea about how to export the data from TS to ascii? So i would have my old continuous contracts to run my tests on?
M.
Size:
Color:
QUOTE:
Any idea about how to export the data from TS to ascii?
Have you already asked your TS support rep/left a query on their forum/etc.? As you could have noticed, this is a Wealth-Lab support forum. ;)
Size:
Color:
No, i didnt :-), i know this is WL forum i was thinking you have already been asked similar question, and u have some expirience with TS users.
I can save this data from my strategy (from my program), i know i have to separate them by coma, but i have no idea how should the format looks like. Date,O,H,L,C ? Should another data be saved also?
Size:
Color:
As long as each data file contains the data for a single symbol (multiple securities in single file have never been supported by Wealth-Lab), it's OK to save any data fields you find useful in your analysis (e.g. adjusted close). The WL6 ASCII provider is flexible enough to import almost any known flavor of data.
For all the possibilities, make sure you've read the WL User Guide: Data > Data Manager > Create New DataSet > Data Providers > ASCII.
Size:
Color:
Ok thanks for the help so far, you helped me lot. I already imported my continuous contracts from TS :-).
Can you please also provide a simple code for simple reversing strategy with reversing position after HH and LL of last 100 bars, but the trades will be not on same daily bar. Simple exit on one bar and entry opposit dirrection on next bar. I would like to compare the results with my old results.
I have 2 more questions:
1. I would like to use the "RiskStopLevel" command but risking fixed amount of dollar per trade. Is this possible?
2. When i manage the first step, i would also like to test my portfolios on % risk on trade, but this percent would change with actuall drawdown. Is it possible? If this is possible, it would make sense for me to purchase WL, because this is the point i want to reach. To test the portfolios with dynamic risk % depending on drawdown.
Thanks. M.
Size:
Color:
QUOTE:
Simple exit on one bar and entry opposit dirrection on next bar.
Feel free to explore the rule wizard on this one, should be a pretty easy task.
QUOTE:
I have 2 more questions:
#1 - Not out of the box, unless I'm mistaken - but that would be feasible in a PosSizer.
#2 - Again, not out of the box. Sounds like a promising idea for a new PosSizer though. Would you please expand on the formula/algorithm so I could start sketching it for a later release of MS123 PosSizer Library?
Size:
Color:
What do you mean by rule wizard?? I can make such strategy fast with the rules, but i would like to have the code, so i can add the "RiskStopLevel" command to the code.
It is just my idea, i am not sure it will work. Therefore i am searching for testing software where i can proove it.
Rules are simple (of course the numbers are not static, i would like to test different values) but:
1. I want to risk 2% of my bankroll on a trade
2. If my drawndown is getting bigger and bigger (i am loosing money) i would like to risk less and less. For example for every 10% of drawdown i will risk 10% less, so if am at 10% drawdown i ll not risk 2% of my bankroll but i ll risk 10% less = 1.8% of my bankroll.
Sounds fine i just need to test it :-).
M.
Size:
Color:
Thanks for the clarification. Sounds feasible.
QUOTE:
What do you mean by rule wizard?? I can make such strategy fast with the rules, but i would like to have the code, so i can add the "RiskStopLevel" command to the code.
Click on "Open in a new strategy window" to see the code and edit it.
Size:
Color:
Ok i get it. :-)
Size:
Color:
Ok it seem i have my strategy and my data that i want now.
Now i would like to deal with the position sizing issue. First i just want to risk lets say fixed 1 000 000 USD on trade, so that when my trade starts at HH of 100 days my stop and reverse will be at LL of 100 days and these ticks between them will be exactly 1 000 000 USD. I want to test isolatet futures and also a whole portfolion.
Can you bring me further?
M.
Size:
Color:
As I mentioned, "Max $ Risk" is not an option currently unless you're willing to develop your
own PosSizer.
Customers with the
PosSizer library installed probably can achieve this by enabling the "Don't Reinvest" option in this PosSizer:
Position Options and setting a % risk which corresponds to the fixed amount of equity (e.g. $1,000,000). This way, the position size no longer will change with the equity, staying fixed.
Size:
Color:
You could do a Fixed $ Risk with the SetShareSize method in the script. Select WealthScritp Override in the sizing control and pass the number of shares calculated to SetShareSize().
Size:
Color:
Cone thanks, can u post a code example?
One thing i dont understand. I was reading mostly just good recomendation for WL.
I tought it is the right software for me. Somehow i am not able to test the simplest thing. I just want to risk fixed $ on a trade, but my stoploss is variable, it means i am risking the same amout of $, but on different amount of ticks. (which is actually standard way of position sizing).
Hmmm...
Is there a way to code my own position sizer? Any links to some "How to" tutorials?
Thanks.
Size:
Color:
Here's your simplest thing. You need to calculate the variable number of contracts in your strategy:
CODE:
Please log in to see this code.
And then select the WealthScript Override option in the position sizing control.
P.S. As with any Wealthcript method, hit F11 to invoke the QuickRef, there start typing the first letters of
SetShareSize for a code example.
Size:
Color:
Size:
Color:
Eugene thanks for your help.
You know now is the time for me to decide if WL is the software for me or not. I have no problem to purchase WL, when i know this is the thing which will help me to do the counting i need. Because obviously TS cannot.
Thanks again, i ll take a look and respond soon.
M.
Size:
Color:
QUOTE:
2. If my drawndown is getting bigger and bigger (i am loosing money) i would like to risk less and less. For example for every 10% of drawdown i will risk 10% less, so if am at 10% drawdown i ll not risk 2% of my bankroll but i ll risk 10% less = 1.8% of my bankroll.
I will implement this idea as an option in the
Drawdown / Runup PosSizer -- where it naturally belongs -- in a future release.
The option will allow to either reduce or
increase the size with each N% lost during drawdown below specified magnitude. As a bonus, it would allow to apply the idea to any standard position sizing choice (not just the "Max % risk" sizing).
Size:
Color:
The
suggestion was implemented in version 2011.07 of the extension.
Size:
Color: