Simple Scripting help

Optuma Forums Optuma Scripting Simple Scripting help

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #60401
    AvatarMajid
    • Topics: 1
    • Replies: 6
    • Posts: 7

    Hi there,
    I want to write a very simple script for myself and hoping you can help me with.
    I would like to draw a horizontal line on closing price of monthly, weekly and daily bases. The horizontal line start with end of month, week or day closes price and continue till next date to change. for example horizontal line for month of Sep is closes price on 31th Aug and end on 30 the Sep – new horizontal line generated for closes price on 30th Sep then continue for month of Oct. – same for weekly and daily chart
    Majid Ghasemian

    1 user thanked author for this post.
    #60402
    MatthewMatthew
    • Topics: 5
    • Replies: 317
    • Posts: 322

    Hi,

    If you are just starting out with scripting i’d highly recommend checking out the free courses first, before going any further.  They will answer a lot of the questions you’ll have early on and make the setup process much quicker.

    https://learn.optuma.com/scripting-courses/

    With your specific example what you are after can be done using the Show Plot tool and a multi-plot script…

    Each variable is using the Close function, but with different time frame overrides (Week, Month, etc) and then uses a 1 bar offset to make sure it’s the previous value being plotted.

    Here is an example of how it looks on a daily chart:

    Ex6

    #60403
    AvatarMajid
    • Topics: 1
    • Replies: 6
    • Posts: 7

    Thanks for your prompt response, mate
    I am looking for something cleaner, just to draw trend line and between the horizontal line too,
    see attached

    Attachments:
    #60406
    MatthewMatthew
    • Topics: 5
    • Replies: 317
    • Posts: 322

    Hi,

    The original script can be adjusted to display in a similar way to your screen shot.  Just drop the daily plot and change the colours for the remaining two lines.

    Screen Shot:

    Ex7

    • This reply was modified 1 month, 1 week ago by MatthewMatthew.
    1 user thanked author for this post.
    #60411
    AvatarMajid
    • Topics: 1
    • Replies: 6
    • Posts: 7

    Perfect, mate
    Thanks a lot

    #60537
    AvatarMajid
    • Topics: 1
    • Replies: 6
    • Posts: 7

    I have couple of questions, here

    • how is it possible to make scanner to show when red or green “show bar” turns to green or red.
    • Is it possible to have only first show bar and not seen other until it changes
    #60541
    AvatarMajid
    • Topics: 1
    • Replies: 6
    • Posts: 7

    WOW

    #60543
    AvatarMajid
    • Topics: 1
    • Replies: 6
    • Posts: 7

    I want to write a scanning script to highlight on first red or green arrow –
    red for selling short and green for buying long
    as first entry would be best entry – my current scanning script pick up all the stocks – basically looking for script to pick when red arrows turns to green or vis versa

    #60551
    AvatarMajid
    • Topics: 1
    • Replies: 6
    • Posts: 7

    This is a perfect example – when green arrow just change to red arrow – my arrows scripts as follow

    V1 = CLOSE(day(PERIODAMOUNT=1), OFFSET=1) ; V2 = CLOSE(Week(PERIODAMOUNT=1), OFFSET=1) ; V3 = CLOSE(Month(PERIODAMOUNT=1), OFFSET=1) ; close() > V1 and V1 > V2; and MACD(BAR1=12, BAR2=26, OSC=9).Histogram >= 0

    V1 = CLOSE(day(PERIODAMOUNT=1), OFFSET=1) ; V2 = CLOSE(Week(PERIODAMOUNT=1), OFFSET=1) ; V3 = CLOSE(Month(PERIODAMOUNT=1), OFFSET=1) ; (close() < V1 or V1 < V2) and MACD(BAR1=12, BAR2=26, OSC=9) <= 0

    Attachments:
    #60591
    DarrenDarren
    • Topics: 62
    • Replies: 503
    • Posts: 565

    Hi Majid,

    Try changing the criteria from V1 > to V2 to V1 CrossesAbove V2 to get the signal:

    Also, when pasting a script formula in the forum please see this pinned post:

    https://forum.optuma.com/topic/how-to-add-code-samples-to-forum-posts/

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

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close