Hi
There are a number of system scans in Edgerater that refer to an existing condition, rather than a crossover.
One example is High Close which generates an event if the close price is higher than every prior close price over the last N bars.
The problem I am having is to code this so that only the first instance is recorded, not every consecutive high close. If we set N equal to 5 and the close price keeps going up, there would also be an event for the 6th, 7th 8th etc for as long as the trend keeps going up.
I have not been able to come up with a solution although something similar is done with the SIM_2_20EMA upside breakout. I have not been able to transfer that concept to the High Close Scan.
Help would be appreciated.
Dan
Limit event to first ocurrence
Moderator: Chris White
-
- Posts: 212
- Joined: Mon Nov 29, 2010 9:21 pm
Re: Limit event to first ocurrence
Hi Dan,
One way of achieving this is to generate an event whenever the HighClose signal goes from 0 to 1. You can use the CROSS function for that to detect a cross of the 0.5 value.
Here's a complete solution:
Chris.
One way of achieving this is to generate an event whenever the HighClose signal goes from 0 to 1. You can use the CROSS function for that to detect a cross of the 0.5 value.
Here's a complete solution:
Code: Select all
HC: (HHV(C, N) == C);
Event: CROSS(HC, 0.5);
Re: Limit event to first ocurrence
Hi Chris,
Thanks for responding so quickly and for an elegant but simple solution,
Dan
Thanks for responding so quickly and for an elegant but simple solution,
Dan