- ago
Wealth-Lab 6 offered a way to create a screener (Section 12.1 in the Programming Guide). Is there a way to create screeners in WL 7? While I'm at it, will the Programming Guide be converted into 7? Thanks!
0
1,393
Solved
3 Replies

Reply

Bookmark

Sort
- ago
#1
QUOTE:
Wealth-Lab 6 offered a way to create a screener (Section 12.1 in the Programming Guide). Is there a way to create screeners in WL 7?

Yes, of course. Suppose you wanted to translate the WealthScript Programming Guide example of V6:
CODE:
protected override void Execute() { int bar = Bars.Count - 1; // the last chart bar number if (bar < 199) return; // chart must have at least 200 bars to continue if ( Close[bar] > SMA.Value(bar, Close, 200) && Lowest.Value(bar, ROC.Series(Close, 5), 200) > -20 && SMA.Value(bar, Volume, 20) > 100000 && RSI.Series(Close, 10)[bar] < 50 ) BuyAtMarket(bar + 1); }


In WL7 you would come up with this code then:
CODE:
//execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) {          if (idx < bars.Count - 1) return; // run only on the last bar...          if (idx < 199) return; // chart must have at least 200 bars to continue           if (bars.Close[idx] > SMA.Value(idx, bars.Close, 200)           && Lowest.Value(idx, ROC.Series(bars.Close, 5), 200) > -20           && SMA.Value(idx, bars.Volume, 20) > 100000           && RSI.Series(bars.Close, 10)[idx] < 50          )             PlaceTrade(bars, TransactionType.Buy, OrderType.Market); }
1
Best Answer
Cone8
 ( 6.24% )
- ago
#2
The WL7 code is missing a statement to make it a screener...
CODE:
public override void Execute(BarHistory bars, int idx) {       if (idx < bars.Count - 1) return; // run only on the last bar... .. the rest as above
2
- ago
#3
Thanks, updated.
0

Reply

Bookmark

Sort