Help on a SHOWBAR and SHOWVIEW script

Optuma Forums Optuma Scripting Help on a SHOWBAR and SHOWVIEW script

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #66501
    Louis
    • Topics: 19
    • Replies: 26
    • Posts: 45

    Hi,

    I am trying to script a signal into the showbar tool. I want to see a green arrow when price closes above the upper line of a 125-day Bollinger Band set to 1 standard deviation and I also want to see a red arrow when price closes below the lower line of a 125-day Bollinger Band set to 1 standard deviation. I have two separate scripts for this that are working:

    I now want to take this a step further. Please take a look at the attached pictures. Picture 1 is what I want to see and picture 1 is what my current scripts show. The difference is that I don’t want to see a green arrow every time the close is above the upper BB. I want to see a green arrow every time price crosses above the upper BB after a red arrow has triggered – which happens when price closes below the lower BB, but that only when it happens after a green arrow is triggered. How do I make it so my green arrow shows only after a red arrow and my red arrow shows only after a green arrow?

    As a second part of this, you will notice that I have tried to recreate the bottom plot from picture 1 using the showview tool in picture 2. It does not look like picture 1. The signal is given but then does not stay shaded until the next signal. How do I recreate this?

    Thank you so much!

    #66521
    Matthew
    • Topics: 5
    • Replies: 487
    • Posts: 492

    Hi,

    This can be done using a mix of SignalAfter() functions and the Switch() function.

    For the arrows on the chart you can use the following:

    Crosses Above

    Crosses Below

    For the Indicator along the bottom the following will work:

    This is how it would all look on a chart…
    Ex2

    #66607
    Louis
    • Topics: 19
    • Replies: 26
    • Posts: 45

    Thank you very much. This works perfectly.

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

Pin It on Pinterest