- ago
Discussion moved from:
https://www.wealth-lab.com/Discussion/Allow-pasted-WL7-code-to-run-in-WebBuilder-7249

QUOTE:
struggling to convert code with a two-page diagram to help us.

The diagram you're referring to is just the starting point. The final build of 6.9 contains QuickRef full of WL7 equivalents. The updated QR can be downloaded separately or as part of WL 6.9. To close the WL6 topic, a search for "equivalent" or "WL6" brings quite a number of helpful examples.
0
482
17 Answers

Reply

Bookmark

Sort
- ago
#1
Eugene, I realize that the two-page diagram is a starting point, but the "QuickRef" is not so quick. I haven't found it useful.
What would be useful is more side-by-side complete code examples, for sure. If I missed these, please tell me where to find them.
0
- ago
#2
For sure we don't have much in the way of side by side code comparisons between WL6 and WL7, if you have a particular WL6 code you want to see converted just post it here and I can convert it.
0
- ago
#3
Glitch, many thanks.
Some things to consider as food for thought:
1. Look after existing customers—they are your easiest new customers.
2. Leverage WealthSignals as a marketing tool—nothing speaks louder than proving what WL can do.
3. Lead new customer acquisition efforts with WebBuilder—it speaks to the mainstream user who's comfortable in a browser-based environment and already uses a host of intuitive web-based charting and screening tools.
4. Weigh the pros and cons of scope creep vs ease-of-use/approachability.
2
- ago
#4
How would you express in WL7 code that the current bar is at least 4 bars later than the position entry bar?

Thank you!
0
- ago
#5
In 6.9, you could say "Close is greater than the Highest.Value" and then choose a parameter like Close or High and give a starting position and a lookback range.

How is this accomplished in WL7?

Thanks.
0
- ago
#6
CODE:
Position pos = LastOpenPosition; if (idx - pos.EntryBar > 3) { }
1
- ago
#7


or ...

CODE:
using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Indicators; using System.Drawing; namespace WealthScript3 { public class MyStrategy : UserStrategyBase { //Initialize public override void Initialize(BarHistory bars) {          hh = Highest.Series(bars.High, 20);          PlotTimeSeries(hh >> 1, "HH-1", "Price", Color.Red);          StartIndex = 20; } //Execute public override void Execute(BarHistory bars, int idx) {          if (bars.Close[idx] > hh[idx - 1])             SetBackgroundColor(bars, idx, Color.LightCoral);              }       //private members       private IndicatorBase hh; } }
0
- ago
#8
Thanks Glitch.
I guessed the first one correctly - yay!

For the second one, I couldn't find the parameter "highest".

Many thanks.
0
- ago
#9
Just to be clear,

CODE:
if (Close[bar] > Highest.Value(bar-1, Close, 100)

becomes
CODE:
if (bars.Close[idx] > Highest.Series(bars.Close, 100)[idx -1]


There used to be Highest.Value and Highest.Series. I can't remember what the difference was. But now is only Highest.Series?
0
- ago
#10
Yes, an alternative is this ...

CODE:
if (bars.Close[idx] > bars.Close.GetHighest(idx - 1, 100)) { }
0
- ago
#11
A-ha, now that looks slick!

Hopefully, you can see what I mean that's it's not so obvious? Maybe even Eugene can see that now?? ;)
0
- ago
#12
and there's also a Value method in WL7 similar to WL6

CODE:
if (bars.Close[idx] > Highest.Value(idx - 1, bars.High, 100)) { }


and, I never said it was obvious. There a definite learning curve from WL6 going to WL7.
1
- ago
#13
One of the learning challenges for code conversion is that if you create a block that you think represents what you're trying to achieve (as you did above) and then look at the converted code, it is far more verbose than the slick code you wrote in later comments. That technique in WL6, i.e. using the Rules to get the code was somewhat easier.
0
- ago
#14
I think the poster (in Reply# 9) is having trouble using IntelliSense on the WL7 editor to discover what the member functions (i.e. Methods) are for the Highest indicator such as .Series or .Value .... The illustration below shows IntelliSense in action on the WL7 code editor.



You could create a simple IntelliSense video demonstrating how to use IntelliSense with the WL7 editor. But I'm not sure how to title such a video so those who don't understand the operation of the WL7 editor would watch it. Most users would simply assume they already understand how to use the editor--which isn't true in this case.

We assume everyone is a programmer and can use IntelliSense to figure out all the "hidden" Methods these indicators and WL functions (i.e. classes) have. But that's not always the case. Perhaps authoring a special primer blog article which points non-programmers to becoming-a-programmer primer videos for those that want to learn code manipulation better.
0
- ago
#15
Thanks Superticker,
A great idea!
I've found IntelliSense useful in WL6 and you've definitely prompted me to make more use of it in WL7.
Currently, I'm using Notepad++ in a split view to help keep track of the conversion process, which is great, but doesn't benefit from IntelliSense.
I find that you have to know the syntax structure to make good use of it, but definitely a useful tool, thanks.
0
- ago
#16
QUOTE:
Currently, I'm using Notepad++ ...

Well, if you know about Notepad++, then you're a programmer, and you should know about IntelliSense too. The WL7 IntelliSense is better than that of WL6, which is good because WL7 isn't that well documented as WL6.

It's hard to document IntelliSense with still images (which is unfortunate). It really needs a video and some understanding of the hierarchical class structure of Wealth-Lab itself to use it effectively.
0
- ago
#17
Yes, the coders' dirty little secret is out—all you need to become a hard-core programmer is Notepad++ ;).

I agree with your assessment, summed up here:
QUOTE:
understanding of the hierarchical class structure of Wealth-Lab itself to use it effectively.
0

Reply

Bookmark

Sort