Login Page - Create Account

Support Board


Date/Time: Sun, 24 Nov 2024 15:13:27 +0000



[User Discussion] - Spreadsheet Trading off Bollinger Bands

View Count: 2584

[2013-04-09 23:58:17]
j514 - Posts: 5
Hi! So I have attempted to make a simple script that goes long when the price crosses the upper bollinger band, and goes short when the prices crosses the lower bollinger band (and so if I am already holding a long position, when it crosses the lower bollinger band it should 'reverse' short).

Right now, it enters the first position fine, but then it never exits or reverses. This is my 'code':

'Buy Entry' (K3): =(E3 >= AA3)

'Buy Exit' (L3): =(E3 <= AC3)

'Sell Entry' (M3): =(E3 <= AC3)

'Sell Exit' (N3): =(E3 >= AA3)

(where E3 is the last price, AA3 is the upper band value, AC3 is the lower band value)

What am I doing wrong? I have set 'Allow Opposite Entry with Opposing position' to YES
[2013-04-10 03:27:13]
vegasfoster - Posts: 444
If you are reversing then you don't need to exit the open position, so delete the formulas in L3 and N3 and then make sure "Support Reversals" is set to "Yes". Also, I typically use a crossover formula when trading a line, not sure if that is causing you problems or not.
[2013-04-10 20:03:30]
j514 - Posts: 5
OK I deleted my unnecessary follow-up posts, and I've solved the above problem by enabling "CancelAllWorkingOrdersOnExit" and "AllowEntryWithWorkingOrders" and "CancelAllOrdersOnEntriesAndReversals" and "Support Reversals"

However, as vegasfoster points out, using crossover formulas seems preferable, but I cannot figure out how to convert "=(E3 >= AA3)" into a crossover formula since CROSSFROMABOVE and CROSSFROMBELOW require the comparison of 2 ranges, whereas I would like to use them to compare 2 individual cells, such as when E3 crosses AA3. The functions do not seem to work for just comparing 2 cells.
[2013-04-10 20:36:23]
Sawtooth - Posts: 4118
For crossovers, I use something like this:

But entry:
=AND(AA4>E4,E3>=AA3)

Sell entry:
=AND(AC4<E4,E3<=AC3)

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

Login

Login Page - Create Account