How can I code a indicator with end date of using?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #110160 quote
    enuxx
    Participant
    Junior

    Hello,

    I need to code a lot of indicators and share it with friends or other people. But I need to set a “end date” to use it. Example: This indicator is ending one year later to 10/14/2020 and is function is off.

    With which code can I realize?

     

    Thanks
    enuxx

    #110163 quote
    Vonasi
    Moderator
    Master

    You can add something like this to your code:

    if opendate < 20201014 then
    result = average[200] //replace with your indicator code
    else
    result = undefined
    if not done then
    drawtext("Warning - this indicator has expired",barindex,result[1],SansSerif,Bold,16)coloured(128,0,0)
    done = 1
    endif
    endif
    
    return result
    enuxx thanked this post
    #110164 quote
    Vonasi
    Moderator
    Master

    You could even give advanced warning that an indicator is about to expire:

    expirydate = 20180101
    advancewarningdate = 20171201
    
    if opendate >= advancewarningdate then
    if not donewarning then
    drawtext("Warning - this indicator will expire in one month",barindex,result[1],SansSerif,Bold,16)coloured(128,0,0)
    donewarning = 1
    endif
    endif
    
    if opendate < expirydate then
    result = average[200] //replace with your indicator code
    else
    result = undefined
    if not done then
    drawtext("Warning - this indicator has expired",barindex,result[1],SansSerif,Bold,16)coloured(128,0,0)
    done = 1
    endif
    endif
    
    return result
    enuxx and Nicolas thanked this post
    Screenshot_13.png Screenshot_13.png
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

How can I code a indicator with end date of using?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
enuxx @enuxx Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Vonasi
6 years, 4 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/14/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...