VALUEWHEN of an OFFSET

Optuma Forums Optuma Scripting VALUEWHEN of an OFFSET

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #60609
    AvatarKim
    • Topics: 14
    • Replies: 18
    • Posts: 32

    Hi,

    I’m trying to determine the price of 2 signals, but can’t get VALUEWHEN to return the earlier signal. I’ve indicated in the code what isn’t working.
    In the attached screenshot:

    • The green arrows are entry signals
    • The red arrow is an exit signal
    • The hover shows the price of the earliest entry signal
    • The column “Signal” shows the value of Entry2 in the code below; it’s the value of the latest entry signal

    Is this something that just isn’t possible as VALUEWHEN doesn’t have an OFFSET facility?

    Thanks

    Kim

    PS This is related to an enhancement suggestion that Mathew said he’d look at, I’m just impatient!! 🙂

    Back Test Results

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

    Hi Kim,

    Offsets are used with bar values not signals, so an offset of 1 will get the value of the bar before the signal, not the previous signal.

    Here’s a work around using the NonZero function, where variable P2 gets the bardate of the previous signal, and EntryPrice2 get the close value on that bardate i.e. $12.42 in the case of AERI:

    Capture

    2 users thanked author for this post.
    #60763
    AvatarKim
    • Topics: 14
    • Replies: 18
    • Posts: 32

    Hi again, an FYI.

    The script works perfectly on a chart, but the back tester always sees the latest signal as of today rather than the latest signal as of the point in time being back tested. Oh well, looks like I’ll have to wait for the new back tester.

    Thanks again

    Kim

Viewing 3 posts - 1 through 3 (of 3 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