sqrrl99 wrote:Any luck here? I don't know much about coding, but it seems like a small problem with the formula. Something like the crossover needs to be defined as when TL <or= KL, then TL > KL...you buy. Right now, the equals part must be missing. Hope you can find something.
Thanks,
Jason
Hi Jason,
Just to explain to you the challenges here. Normally we are considered with when lines cross each other or a particular value. So let's say we want to know when indicator I crosses value V.
Assuming t = time, imagine the following scenario
T=1: V=10, I = 13
T=2: V=10, I = 11
T=3: V=10, I = 9
T=4: V=10, I = 7
We can see in the above that I crossed V ... but when did it happen? How do we identify a cross?
If the logic to identify a cross is simply:
- Previous value was > V
- Current value is < V
Then the logic will pass on the above, but fail on the following example.
T=1: V=10, I = 12
T=2: V=10, I = 11
T=3: V=10, I = 10
T=4: V=10, I = 9
T=5: V=10, I = 8
However, if we change the logic to say:
- Previous value was >= V
- Current value is <= V
Then the logic will pass on the above, but fail on the following example.
T=1: V=10, I = 12
T=2: V=10, I = 11
T=3: V=10, I = 10
T=4: V=10, I = 10
T=5: V=10, I = 11
However, if we change the logic to say:
- Previous value was >= V
- Current value is < V
Then the logic will pass on the above scenarios, but fail on the following example.
T=1: V=10, I = 8
T=2: V=10, I = 9
T=3: V=10, I = 10
T=4: V=10, I = 10
T=5: V=10, I = 9
and for indicators that can keep the same value for a while, the problem actually looks like this.
T=1: V=10, I = 8
T=2: V=10, I = 9
T=3: V=10, I = 10
T=4: V=10, I = 10
T=5: V=10, I = 10
T=6: V=10, I = 10
T=7: V=10, I = 10
T=8: V=10, I = 9
T=9: V=10, I = 8
So you can try to look further and further back but it just shifts the problem. So as you can see, it isn't quite that easy.
Cheers,
MooMooFX