Login Page - Create Account

Support Board


Date/Time: Fri, 22 Nov 2024 02:08:26 +0000



[Programming Help] - Spreadsheet Formula help

View Count: 88

[2024-11-01 14:57:20]
User321897 - Posts: 3
I'm trying to write a formula that buys long when the bar closes above the MA and the bar open is above the previous bar open. It closes out the trade when the bar closes below the moving average. What I have doesnt seem to be working though.... Does anyone see what I'm doing wrong?

Buy Entry:
=CROSSFROMBELOW(ID0.SG4@3:ID0.SG4@4,ID3.SG1@3:ID3.SG1@4)=AND(ID0.SG1@3 > ID0.SG1@4)

Buy Exit:
=CROSSFROMABOVE(ID0.SG4@3:ID0.SG4@4, ID23.SG1@3:ID3.SG1@4)

It seems to signal all the time and doesnt close when below the moving average.
[2024-11-01 17:31:20]
ForgivingComputers.com - Posts: 959
You aren't using the AND function correctly.

Try this:
=AND(ID0.SG1@3 > ID0.SG1@4,CROSSFROMBELOW(ID0.SG4@3:ID0.SG4@4,ID3.SG1@3:ID3.SG1@4))[code]

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

Login

Login Page - Create Account