12 combination indicator (trying to create)

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #120171 quote
    BjornH
    Participant
    New

    Hi!

    Very new to this, but I am trying to write my very own combination indicator, without much success.

    What I want to create is a indicator line that goes from it lowest value “0” (if none of the requirements are met) to the highest “12”(if all requirements are met)

    My guess is that I need to first create a variable called something like “CountingVariable” … and then, as conditions are met, it will add a +1 to this variable …

    The conditions are:

    if

    • HVO[100] > 20(close) then add +1 point
    • RSI[7](close) > 80 … 3-16 days ago then add +1 point
    • Upper BollingerBand[20, 2stdev] pointing upwards then add +1 point
    • Todays date is between the 24th this month and the 3rd the coming month, then add +1 point
    • Close > average[200] then add +1 point
    • CCI[6] crosses over -100 then add+1 point
    • RSI[2](close) 3 days ago < 60, then add +1 point
    • RSI[2](close) fallen for 3 days, then add +1 point
    • %D[5](close) < 10 then add +1 point
    • RSI[2](close) < 20 then add +1 point
    • RSI[2](close) < 10 then add +1 point

    But how do I create the function that adds 1 point to the indicator line for every requirement that is met … ?

    #120172 quote
    Vonasi
    Moderator
    Master

    Like this:

    count = 0
    
    if RSI[2] < 20 then 
    count = count + 1
    endif
    
    if RSI[2] < 10 then 
    count = count + 1 
    endif
    
    //.....and repeat another 10 times.
    
    return count
    
    
    BjornH thanked this post
    #120174 quote
    Vonasi
    Moderator
    Master

    Personally I prefer to present the result as a % so would do it like this so that you can add or remove conditions and the calculations still works.

    count = 0
    tests = 0
    
    if RSI[2] < 20 then 
    count = count + 1
    endif
    tests = tests + 1
    
    if RSI[2] < 10 then 
    count = count + 1 
    endif
    tests = tests + 1
    
    //.....and repeat however many times you like.
    
    result = (count/tests)*100
    
    return result
    #120179 quote
    BjornH
    Participant
    New

    Wow, thank you very much!

    Is it to much to ask for if you could help me with the function for the date conditions ?

    I´m trying to find something in the help section for the limitation between the 24th this month and the 3rd the coming month … But as I can see it I can only return the current date?

    So I guess I need to make the function that brings up todays date and then look if this date is between the 24th and the 31st this month, or between the 1st and the 3rd the upcoming month … Will an error occur because there are some months with only 30 days etc … ?

    And when I want to check if RSI[2] was < 60 3 days ago ….  and fallen for 3 days … do I need to write an IF function for this as well ?

    • Todays date is between the 24th this month and the 3rd the coming month, then add +1 point
    • RSI[2](close) 3 days ago < 60, then add +1 point
    • RSI[2](close) fallen for 3 days, then add +1 point
    #120181 quote
    BjornH
    Participant
    New

    Like this condition

     

    RSI[7](close) > 80 3-16 days ago …..

     

    this is giving me a headache =)

    #120185 quote
    BjornH
    Participant
    New
    count = 0
    
    if date =>24 and <=31 then
    count = 0 + 1
    endif
    
    if date =>1 and <=3 then
    count = 0 + 1
    endif
    

    something like this … ?

    #120188 quote
    Vonasi
    Moderator
    Master

    OPENDAY returns the day of the month that a candle opens on so:

    if openday >=24 or openday <= 3 then 
    count = count + 1
    endif
    tests = tests + 1

    The number of days in the month makes no difference.

    RSI < 60 three days ago is a little more complicated depending upon what time frame you are using or if you want it to work on all time frames?

    BjornH thanked this post
    #120189 quote
    BjornH
    Participant
    New

    It is for daily charts, yes. Only Daily  …

     

    Thank you very much

    #120190 quote
    Vonasi
    Moderator
    Master

    That’s easier then. The current bar is bar 0 so three days ago is bar 3.

    if rsi[2](close[3]) < 60 then

    Falling for 3 days needs a SUMMATION.

    if summation[3](rsi[2](close) < rsi[2](close[1])) = 3 then

    This will check the last 3 days including the current one.

    BjornH thanked this post
    #120191 quote
    Vonasi
    Moderator
    Master

    Like this condition

    RSI[7](close) > 80 3-16 days ago …..

    this is giving me a headache =)

    You’ll have to clarify this. Do you mean it was > 80 at any point during the period from 3 days ago to 16 days ago?

    #120192 quote
    BjornH
    Participant
    New

    Yes, exactly … price had to print above 80 in the period: 3 to 16 days ago ….

     

    So grateful for your help … reading the help documentation can only take you so far …

    #120193 quote
    Vonasi
    Moderator
    Master

    This should do it:

    if summation[14](rsi[7](close[3]) > 80) <> 0 then
    BjornH thanked this post
Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.

12 combination indicator (trying to create)


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
BjornH @bjornh Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 02/21/2020
Status: Active
Attachments: No files
Logo Logo
Loading...