Bollinger Bands

Optuma Forums Optuma Scripting Bollinger Bands

Tagged: ,

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #69461
    Jeffrey
    • Topics: 15
    • Replies: 7
    • Posts: 22

    Hello,

    I want to be able to scan my custom list for charts where price has extended beyond the 2.0 standard deviation (high and low) on the daily. Not closed beyond, but has just crossed. I know that I need to use the cross above/below script but how do I reference the 2.0 SD lines?

    Also, once I have the script – If I wanted to be alerted any time one of my charts extends beyond the 2.0 SD line, I assume I setup a technical alert. But my question is, will this continuously alert me every time price breaks one of these lines? Or will the alert only work once per chart? Will I need to re-activate it every time?

    Thank you!

    Jeff

    #69463
    Darren
    • Topics: 73
    • Replies: 900
    • Posts: 973

    Hi Jeff,

    Use the following for highs or lows outside a 20 period Bollinger band:

    Instead of setting an alert for each one – and resetting it every time they get triggered – you could open your symbols in a watchlist and use the formula in a column and it will display as true when the condition has been met (such as TSLA and JNJ for yesterday) You could also use it in a Show Bar to highlight on a chart, or use a custom bar colour:

    Capture

    #69467
    Jeffrey
    • Topics: 15
    • Replies: 7
    • Posts: 22

    Thank you, Mr. Hawkins! This is exactly what I was looking for!

    Is there a projected date in which we will be able to receive price/technical alerts via SMS or email?

    #69473
    Jeffrey
    • Topics: 15
    • Replies: 7
    • Posts: 22

    The code works great but I’m trying to run a simple “trade test” to see how often it will breach the 2.0 SD line and close back inside the bands.

    My entry criteria for going LONG is:

    LOW() CrossesBelow BB(Day(PERIODAMOUNT=1), DEFAULT=LowerLine, BARS=5, STDDEV=2.500000)

    Exit:

    Close() >BB(Day(PERIODAMOUNT=1), DEFAULT=LowerLine, BARS=5)

    I made my entry criteria as breaching the 2.5 SD line then exiting when it closes inside the 2.0 SD line to be sure it is counted as profit. (This is the only way I can figure how to do this. I would prefer to run the test with breaching the 2.0 SD line and closing just inside the SD line but not sure how to code this).

    Anyway, my results are wonky – I seem to get a flat line on the trade analysis crossing zero at the Y axis.  Have I entered something wrong?bb

    #69479
    Darren
    • Topics: 73
    • Replies: 900
    • Posts: 973

    Hi Jeff,

    The entries in the Trade Tester are taken on the close of the day once the signal has been confirmed, not the low, so in effect your exit is the same as the entry.

    Also, when building a test it helps to create the entries and exits in a Show Bar first so you can verify that the correct signals are being triggered. There’s no issue with the entry on a daily AUDNZD chart (green arrows), but you will see that the close is above the lower 2SD line (in orange) every day, so the exit occurs immediately (red arrows).

    Capture

    #69481
    Jeffrey
    • Topics: 15
    • Replies: 7
    • Posts: 22

    Thank you for the tips!

    So you’re saying there is no way to test this in the Trade Tester, correct?

    I tried running the test on the 60-minute chart thinking that it may be able to calculate using the close of the hourly bar when passing the Daily 2SD line… no success. Or, I did it wrong >_<

    #69483
    Darren
    • Topics: 73
    • Replies: 900
    • Posts: 973

    OK thanks. You may be able to use the close of the 60min bar on a daily Bollinger Band. Something like this might work:

    MINUTE(PERIODAMOUNT=60) CrossesBelow BB(Day(PERIODAMOUNT=1), DEFAULT=LowerLine, BARS=5, STDDEV=2.500000)

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Pin It on Pinterest