How to use Community.Rules
Author: tradercn
Creation Date: 6/29/2011 11:26 AM
profile picture

tradercn

#1
I downloaded Community.Rules, but I am new and not sure how to use it. What I want is choosing different trading strategies based on one index. For example, for the index, if SMA(50)>SMA(200), then I apply trend following strategy for some specific trading object, or a stock. How can I do that? could you please show me one example? Thanks, Eugene.
profile picture

Eugene

#2
Could you clarify what do you mean by "choosing/switching different strategies" in Rule wizard? Related question: can you give us an idea about the complexity of your "trend following strategy".
profile picture

tradercn

#3
Take a simple example, If index SMA(50)>SMA(200) then use MACD as the entry and exit signal for the stockA, or symbolA. If index SMA(50)<SMA(200), then apply stochastic KD indicator for stockA, so that overbuy signal is selling signal and oversold is a buying signal.
profile picture

Eugene

#4
Sounds like you can solve it by dragging and dropping two entry rules. One (the MACD rule) gets a MACD condition plus the "External Symbol Price is above its Moving Average" rule added by Community.Rules. The remaining entry rule gets two conditions: a Stochastic condition of your choice and "External Symbol Price is below its Moving Average". Voila.

Tutorial Video | Strategy | Use the Wizard to create a Rule-based Strategy
profile picture

tradercn

#5
I fully understand what you mean but my concern is how do apply "'External Symbol Price is above its Moving Average' rule added by Community.Rules". Or simply say, how to reference the functions in Community.Rules? Do you have any example or I have to read the source code?
Many thanks. I am new here, I might bother you a lot later.
profile picture

tradercn

#6
I got it, Eugene. Sorry to bother you. It is easy now. Thanks.
profile picture

tradercn

#7
A new problem. I found the external symbol was fixed as the index of US Market, if I tried to got the external symbol from other dataset, how can I do?
profile picture

Eugene

#8
Type your own symbol in the input field.
profile picture

tradercn

#9
It is great. I found when the external symbol was input, it worked perfect no matter where this symbol located in the same or different dataset. But if there are two same symbols in the different datasets. How to specify which symbol is the one I want to use? Or, how to reference the external symbol in different datasets? thanks.
profile picture

Cone

#10
Using Rules-based code, it's not possible to differentiate. Wealth-Lab will look in the current DataSet first, and then search alphabetically through the DataSets.

In script code, you can specify the DataSet that an external symbol comes from. Just GetExternalSymbol in the QuickRef (F11).
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).