Looking to create a Williams R strategy using Rules
Author: singhrk
Creation Date: 1/21/2020 9:22 PM
profile picture

singhrk

#1
Hello,

I am looking to customize a strategy for Wealth Lab pro.

For instance, I am looking to customize a William Percent R buys and sells based on certain strategies. This can be found under tools and technical indicators or Control + F11, then I would like to code this indicator to buy and sell based on certain criteria.

Also, I would like to further code the AND/OR and multi conditional variable tools that act on a certain interval, lets say an an hour, so if the indicators are true within an hour time frame, then the code acts.

Can we discuss this further?
profile picture

Eugene

#2
Hi Rana,

Welcome to the forums. Sure we can discuss this and get this coded (or implemented in Rule-based strategy) if you tell us more about your trading rules.

Fire away!
profile picture

singhrk

#3
Thank you for your response. For instance let’s start with

Buy function when (AND function when 5 candles at 5 minute intervals are met). The current AND function operates at one moment in time.

Then where can the William R 7 Day Period with overbought line of 80 to execute a buy be added.

I could share the rest of the code that I’ve created so far as well? Could we discuss it in a private setting ?
profile picture

Cone

#4
QUOTE:
Buy function when (AND function when 5 candles at 5 minute intervals are met).
We can help, but I don't really know what this means. Please rephrase and be specific about the rules. What specific conditions are the filters (what has to be true to enable a trigger) and what are the conditions to trigger the trade?

From what I gather above, Williams R over 80 is a filter that must be true to enable buying. It's the trigger(s) that are still a mystery!
profile picture

Eugene

#5
1. Please rephrase all this, I don't quite get the meaning of two "functions" in this sentence: "Buy function when (AND function when..."

2. What does this mean: "when 5 candles at 5 minute intervals are met" ? Are you looking for consecutive bars?

3. Since you mention 5-minute, on what bar scale does the script work?

QUOTE:
Could we discuss it in a private setting ?

No, strategy coding is not a support duty and isn't a private affair. What concerns private matter is e.g. Wealth-Lab Developer keying or payment order, one-on-one troubleshooting involving private data etc.
profile picture

singhrk

#6
Thank you for your response.

Let me try to explain this to the best of my ability.

If this isn't clear please let me know, and I will do my best to re-word this.

There is a drag and drop function that exists on the Wealth Lab pro platform which allows for a user to view the code. Is the code on the Wealth Lab pro platform its own code or is this code from a standard computing language?

I thought that I would ask by starting about the AND function. If you do not choose the OR or multi condition statement and you drag and drop different technical indicators the code only executes if all of the technical indicator criteria are met at an exact point in time.

For instance, I want the code to operate as an AND function at 5 candles at 5 minute intervals to total 25 minutes of time between the 5 5 minute candles to determine if the AND function is met not at ONE point in time, but over 25 minutes, then if all of the the indicators are met somewhere in the 25 minute time frame, the buy function will execute.

My second question was regarding the William R indicator. I see this indicator can be placed on the graph, however, I do not see a drag and drop manner of having it execute a buy or sell function. Could you explain how to code if William R crosses above the overbought level of 90, then the code executes a buy function?

Thank you for your time
profile picture

superticker

#7
Wealth-Lab supports two separate and independent paradigms for defining a trading strategy. One is from "C# code" which is not drag and drop. The other is from "rules" which is drag and drop. The former is more flexible and powerful, but you'll need to write your strategy in C# code. The latter does not require coding, but it has more limited functionality. You would use one or the other paradigm for a given strategy, but not both. You can write your simple strategies with the rules paradigm, and your more complex strategies with the C# coding paradigm.
profile picture

Eugene

#8
QUOTE:
Is the code on the Wealth Lab pro platform its own code or is this code from a standard computing language?

To expand on Mark's reply, the code behind Rule-based strategies is the same industry standard C# language. Moreover, a standard feature of Strategy from Rules is to generate it once you're satisfied with what you've created with drag and drop.

QUOTE:
but over 25 minutes, then if all of the the indicators are met somewhere in the 25 minute time frame, the buy function will execute.

The kind of logic you're looking for is called "fuzzy logic". In Wealth-Lab's Strategy from Rules it's enabled by using "Multi-Condition Groups". Check out the Wealth-Lab User Guide (WL Help menu) > > Strategy Window > Strategy Builder > MC, Multi-Condition Group chapter on how to use the feature. Check out our tutorial video on Youtube:

Wealth-Lab 101: Strategy Builder Multi-Condition Groups

QUOTE:
however, I do not see a drag and drop manner of having it execute a buy or sell function.

This is explained in our educational series on YouTube> Wealth-Lab 101: Course Videos. In particular, Intro to Strategy Builder. In Wealth-Lab, Williams R is like any other indicator exemplified in the course (RSI) so once you learn the basic principle you'll know how to employ any indicator.
profile picture

singhrk

#9
Thank you for your response and explanations.

I now understand the look back period and how this relates to the and/or/MC functions. Thank you for that explanation and User Guide referral.

To clarify, it is not possible start the code in the drag and drop function then afterwards code from the New Strategy from Code after a template is created? Or does all of the code required to be created from C#? I am not too familiar with this coding language, yet wish to code certain technical indicators that are not available in the drag and drop function, how would you recommend that I proceed?

I have watched many of those youtube videos. It is quite clear how to drag and drop an RSI indicator. William percent R is not one of these drag and drop indicators, and I am uncertain of how to code this technical indicator. Maybe I am misunderstanding something, could you please advise?

I look forward to hearing back from you.
profile picture

Eugene

#10
You're welcome. All technical indicators are available immediately to the drag and drop function which we call Strategy from Rules or the Rule Wizard. I thought it should be in the videos but in case it's not, the feature that makes them available is the General Indicators group on the Conditions tab. It brings together the various actions one can do with indicators: cross above/below a value or price or indicator etc., increase/decrease, making a new high/low and many more. Any rule in that group contains an Indicator field with prompt that says "[Click here to select an Indicator]". The rest is self-evident I hope.

The library Community.Rules extends this list of what you can do with General Indicators even further. By the way, Wealth-Lab is very extensible platform.
profile picture

superticker

#11
QUOTE:
To clarify, it is not possible start the code in the drag and drop function then afterwards code from the New Strategy from Code after a template is created? Or does all of the code required to be created from C#?
Yes, it's possible to employ the rules paradigm to initially develop your trading strategy, then convert those rules to C# code later with Wealth-Lab. But that conversion goes only one way; you can't reverse it to convert C# code back to rules again.

So you could use this conversion process to learn C# coding in Wealth-Lab, which is a good approach. You can also add "new lines" to the converted C# code to make the converted C# code more powerful. You do not need to be very proficient at C# coding to write WL strategies from "existing" WL libraries.
profile picture

singhrk

#12
Thank you for your responses. I greatly appreciate it.

I have added William R with your recommendations.
profile picture

Eugene

#13
Glad I could be of assistance.

Should you have any followup questions (be it an issue or bug, general usage question, or Strategy coding assistance), don't hesitate to ask them on the Forum. Often times questions have been discussed before and answers can be found as you type by entering a few keywords in the "Search Forum..." text box.

If a solution for your problem can't be found in an existing thread, please ask us on the Wealth-Lab Forum by clicking on a category and then starting a "New Topic".
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).