- ago
In TS I use this code :

If close > highest(close,10)[1] then

How to code in C# in WL ?
1
364
Solved
8 Replies

Reply

Bookmark

Sort
- ago
#1
CODE:
if(bars.Close[idx] >= Highest.Series(bars.High, 10)[idx - 1])
0
- ago
#2
The whole strategy in TS looks like this :

If close > highest(close,10)[1] then buy this bar on close;
If close < lowest(close,10)[1] then sell short this bar on close;

How could I code this with WL ?
0
- ago
#3
We have already answered a similiar question to you:

Stop and Reverse strategy question

Experiment with the code provided by @Cone, replacing the close above/below conditions with the line above.
0
- ago
#4
When I replace
"if (qqq.Close[idx + 1] > qqq.Close[idx - 2])"
with
"if(qqq.Close[idx] >= Highest.series(qqq.Close)[idx - 1])"

I get the error "no definition for "series".
0
- ago
#5
Why introduce absolutely unnecessary errors (that my Post #1 doesn't contain) by typing it when you can simply copy and paste that code? 🤷‍♂️ C# is case sensitive.
0
- ago
#6
Same error if I copy and paste !

if(bars.Close[idx] >= Highest.Series(bars.High)[idx - 1])
0
- ago
#7
OK, I missed the period (10). Post #1 edited. Please retry.
0
Best Answer
- ago
#8
Thank You !

Now it works.
1

Reply

Bookmark

Sort