How do I make an alert that triggers once only?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #178680 quote
    eternalcode
    Participant
    New

    I just want an alert to trigger once after passing a certain price, then disable itself to avoid any future triggers.

    I’d like to place partial profit taking with alerts without worrying about more than one orders being placed because of price fluctuations.

    How can I do this? Thanks

    #178696 quote
    Nicolas
    Keymaster
    Master

    Unless I am mistaken, it is not possible to stop an alert automatically after its first occurrence, sorry!

    #178740 quote
    eternalcode
    Participant
    New

    I’m trying to think of using multiple conditions as a workaround.

    So far I’ve come up with:
    c1 = a close of the current 15m bar above a drawn price line, c2 = before a certain date & time.

    It’s not ideal as there can still be multiple 15m closes before that time, if I’m not around to catch the first. Can I do anything better?

    #178961 quote
    Eric
    Participant
    Master

    Use a binary indicator (cross over/under zero)

    1 the condition you use (c1)

    -1 something that never happens (c2)

    // Detection donk
    D5T = HIGHEST[5](HIGH)[1]
    c1 = CLOSE > D5T
    
    // Detection donk
    D15B = LOWEST[15](LOW)[1]
    c2 = LOW < D15B
    
    IF c1 THEN
    res = 1
    ELSIF c2 THEN
    res = -1
    ENDIF
    
    return res as "DONK BINARY"
    #198605 quote
    ang2v
    Participant
    New

    Has code above been backtested?  Considering using a tick timeframe to buy a certain price and set a certain range at open.  That’s not to say that same price won’t be hit again.  Would it be likely given the extreme volatility at open?  How instantaneous are the triggers?  Is best option to disable the alert once executed either manually otherwise surely this could be coded.

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

How do I make an alert that triggers once only?


Platform Support: Charts, Data & Broker Setup

New Reply
Author
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by ang2v
3 years, 7 months ago.

Topic Details
Forum: Platform Support: Charts, Data & Broker Setup
Language: English
Started: 09/28/2021
Status: Active
Attachments: No files
Logo Logo
Loading...