Login Page - Create Account

Support Board


Date/Time: Sun, 05 May 2024 10:57:12 +0000



[User Discussion] - Crossover strategy

View Count: 1497

[2015-02-14 05:16:30]
User96105 - Posts: 113
Hi, I’m working on a crossover strategy using the Fisher Transform. But I’m getting too many signals and I want to adapt the code so that the crossover only happens when the transform exceeds* the offset (for the buy) and the offset exceeds* the transform (for the sell). *It would help if I can vary the amount it exceeds by.

Can anyone help with this code?

Thanks

[2015-02-14 10:27:59]
User96105 - Posts: 113
This is what I was thinking of:-

Buy =AND(CROSSFROMBELOW(C3:C4,D3:D4), C3>(D3+0.2))

Sell =AND(CROSSFROMABOVE(C3:C4,D3:D4), D3>(C3+0.2))

But the problem with this is that the opposite position isn't triggered unless the Transform exceeds the Offset by at least 0.2 on the crossover bar (for the Buy). I need the trade to execute on subsequent bars when the offset is exceeded by 0.2.

Any ideas?

Thanks.
[2015-02-14 15:27:03]
Sawtooth - Posts: 3993
Your formulas will occasionally give subsequent signals of the same direction. This is to be expected when there is an offset.

If you want to ignore subsequent signals of the same direction, try this:

O3:
=IF(AND(CROSSFROMBELOW(C3:C4,D3:D4),C3>(D3+0.2)),TRUE,IF(AND(CROSSFROMABOVE(C3:C4,D3:D4),D3>(C3+0.2)),FALSE,O4))
this goes TRUE at the first cross from below, and stays TRUE until the first cross from above.

P3:
=IF(AND(CROSSFROMABOVE(C3:C4,D3:D4), D3>(C3+0.2)),TRUE,IF(AND(CROSSFROMBELOW(C3:C4,D3:D4),C3>(D3+0.2)),FALSE,P4))
this goes TRUE at the first cross from above, and stays TRUE until the first cross from below.

K3:
=AND(O3,O4=FALSE)
this finds the first cross from below TRUE

M3:
=AND(P3,P4=FALSE)
this finds the first cross from above TRUE
[2015-02-14 20:03:53]
User96105 - Posts: 113
That's really very helpful Tom, many thanks.

But I have confused the issue with my poor description. The main problem I have is not multiple/repeated subsequent signals in the same direction ~ it's the 1st signal not always firing. I assume that the "CROSFROMBELOW" (etc) function is specifically designed to identify the cross and to fire immediately on that bar. My amateur code is effectively saying ignore the cross unless the crossover amount exceeds at least 0.2. Because of this unless that bar does fulfill the criterion the function is nullified entirely until another cross is made which does exceed 0.2.

From the attached screenshots* you can see that the transform crossed from below at 21:01:16, but the cross was just 0.11, so no long trade was triggered. The next buy wasn’t triggered until 21:11:34. What I would like to achieve is for the buy trade to have been executed at 21:01:23 (the next bar) when the transform was -0.51 and the offset -0.76 (the first time following the cross when the transform exceeded the offset by at least 0.2).

Many thanks for your help with this….

*Note that buy/sell entry arrows are not showing on my chart for some reason, so I am using dots ~ which do work!!







attachmentSpreadsheet.pdf - Attached On 2015-02-14 19:51:13 UTC - Size: 111.61 KB - 326 views
attachmentChart.pdf - Attached On 2015-02-14 19:51:24 UTC - Size: 23.99 KB - 315 views
[2015-02-14 22:28:40]
Sawtooth - Posts: 3993
You can use the same logic concept in post #3 to 'latch' the crossover TRUE to wait for the offset to be reached:
O3:
=IF(CROSSFROMBELOW(C3:C4,D3:D4),TRUE,IF(CROSSFROMABOVE(C3:C4,D3:D4),FALSE,O4))
P3:
=IF(CROSSFROMABOVE(C3:C4,D3:D4),TRUE,IF(CROSSFROMBELOW(C3:C4,D3:D4),FALSE,P4))

Then latch the offset TRUE until the opposite crossover so that you don't get multiple entries:
Q3:
=IF(AND(C4-D4<=0.2,C3-D3>0.2),TRUE,IF(CROSSFROMABOVE(C3:C4,D3:D4),FALSE,Q4))
R3:
=IF(AND(D4-C4<=0.2,D3-C3>0.2),TRUE,IF(CROSSFROMBELOW(C3:C4,D3:D4),FALSE,R4))
(I modified the offset formulas)

Then find the first time they both are TRUE:
K3:
=AND(O3,Q3,Q4=FALSE)
M3:
=AND(P3,R3,R4=FALSE)

You may need to release the double IF latch with another condition to get the exact entries you want. A variation of this concept can be used in a variety of situations.
Date Time Of Last Edit: 2015-02-15 04:55:50
[2015-02-16 18:25:31]
User96105 - Posts: 113
Many thanks for your help with this Tom.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account