- ago
I'm trying to convert the TASC 2016-04 | Trading Gap Reversals (Calhoun) WL6 code to WL8 as shown at http://www2.wealth-lab.com/WL5WIKI/TASCApr2016.ashx but I'm struggling to convert the following lines:

CODE:
int firstBarToday = bar - Bars.IntradayBarNumber(bar); int lastBarYesterday = firstBarToday - 1; bool priceFilter = (Close[firstBarToday] >= 20) && (Close[firstBarToday] <= 70); bool gap = (Open[firstBarToday] <= trigger[lastBarYesterday]);
The first equation doesn't even make sense to me. How does that compute to firstBarToday?

And aren't "gaps" defined as price spaces between the closing price of the last bar and the opening price of the following bar?

By the way, the above URL is not formatting the strategy code right.
0
145
Solved
3 Replies

Reply

Bookmark

Sort
Glitch8
 ( 10.58% )
- ago
#1
>>The first equation doesn't even make sense to me. How does that compute to firstBarToday?<<

Ok let’s unpack this. Let’s say bar is 1000 and IntradayBarNumber is 10.

1000 - 10 is 990, so it’s telling us that bar number 990 would have been the first bar of that day.

Makes sense to me 🤷🏼‍♂️
0
- ago
#2
QUOTE:
bar number 990 would have been the first bar of that day

So we are counting every intrabar as "one" complete bar such that if you had 100 days at 30 minutes, then you would have 100x11=1100 "total" bars counted.

Somehow I was thinking one bar equaled one day, but that's wrong. Apparently your logic works (Thanks for explaining it.), but it's a little confusing. Now someone please show me how this code converts to WL8.
0
Cone8
 ( 7.72% )
- ago
#3
It's precisely the same. Just note the name change from "idx" to "bar" in the Execute() parameter list. You can do it there or change bar to idx in the code.

CODE:
public override void Execute(BarHistory bars, int bar) {          int firstBarToday = bar - bars.IntradayBarNumber(bar);          int lastBarYesterday = firstBarToday - 1;          bool priceFilter = (bars.Close[firstBarToday] >= 20) && (bars.Close[firstBarToday] <= 70);          bool gap = (bars.Open[firstBarToday] <= trigger[lastBarYesterday]); }
1
Best Answer

Reply

Bookmark

Sort