X happened in at least 4 out of 5 bars ?
5 replies
rjay
12 years ago #112706
I need to program a rule that says the bar must have closed lower than the open in at least 4 of the last 5 bars.
Is that possible with EA Wizard ?
0
Mark Fric
12 years ago #126775
yes, it is possible, but it will be little bit tricky, because it is a cycle, which is not simple to do in rule based wizard.
You’d have to create rules like:
Init:
Assign variable Matches = 0
Rule 1:
IF Close[1] < Open[1] THEN Matches = Matches + 1
Rule 2:
IF Close[2] < Open[2] THEN Matches = Matches + 1
Rule 5:
IF Close[5] < Open[5] THEN Matches = Matches + 1
Mark
StrategyQuant architect
0
Count-Roy
12 years ago #127094
so this doesn’t work then??
force Index (x) (1) < force Index (x) (-5)
or
RSI(x) (1) < Rsi(x) -7
because I too want to make the EA enter the trade when the value is X but also then it was in the previous X period, give or take an X number of bars.
looking forward to hearing this one. because I actually entered that in to a EA I am trying to get running. I have made 14 different orders with also 14 different magic numbers, 7 for short and seven for long. clone this rule I did for the 7 short and then for the 7 long. all the long I have given odd numbers going from 1 – 13 and the shorts 2 – 14 I also changed the to match the direction I want to go.
what I don’t understand is why the EA only trades the short and not the long, maybe this last bit of my reply is a bit of topic to this post. but still.
I have inclused a simple example, which doesn’t work like I would expect it to. strange, do you think you can fix this problem with the EA Wizard.
greetz
0
Mark Fric
12 years ago #127134
force Index (x) (1) < force Index (x) (-5)
you cannot use negative values for shift, you would be looking into the future and indicator will most probably return 0.
If you meant comparing RSI value 1 bar ago with RSI value 5 bars ago then use Shift=1 and Shift=5 for that.
But if you want to check that RSI 1 bar ago was smaller than RSI in any other bar in the last 5 bars you have to write this kind of conditions one by one – compare always RSI(x)[1] < RSI(x)[2], RSI(x)[1] < RSI(x)[3] etc…
Mark
StrategyQuant architect
0
Brignac Roofing
11 years ago #129005
Mr. Fric,
I noticed you have in your last comment RSI(x)[1]<RSI(x)[3].
My question is: Is this a shorter way to write the rule and mean the same as below?
RSI(x)[2],< RSI(x)[3]
RSI(x)[1], < RSI(x)[2]
RSI(x)[0] < RSI(x)[1]
I am always writing this rule above but would save me a ton of time if your rule 1 < 3 would mean the same thing
0
Mark Fric
11 years ago #129123
RSI(x)[1]<RSI(x)[3] means that RSI 1 bar back is lower than RSI 3 bars back.
It doesn’t compare any other bars in between, I meant probably something else than you in my comment.
Mark
StrategyQuant architect
0
Viewing 5 replies - 1 through 5 (of 5 total)