Code of series of periods

Viewing 10 posts - 16 through 25 (of 25 total)
  • Author
    Posts
  • #104155 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    All’s well that ends well! 🙂

    #104157 quote
    GraHalGraHal
    Participant
    Master

    All’s well that ends well!

    Maybe not … @maximus78 may have used Roberto code (thinking it was correct / what he needed) and has blown his account … never to be seen again!

    Only teasing! 🙂

    #104158 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Yes, but he can refund it and win this time! 🙂

    #104159 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    I know reviving old topics may be dangerous, but keeping an error running is more dangerous!

    #104168 quote
    maximus78maximus78
    Participant
    Senior

    Hello guys, I remember I have verified the code line of Roberto and it was right.

    Now I have verified again in this way and as you can see the results are exactly the same.

    I did an indicator called Maximus with the code of my request:

    a=close>close[1] and  close>close[2] and close>close[3] and close>close[4] and close>close[5]
    
    if a then
    result=1
    else
    result=0
    endif
    
    return result

    Then i did another indicator called Roberto with his code:

    IF close > highest[5](close[1]) THEN
    result=1
    else
    result=0
    endif
    
    return result

    Comparing the results of the binary indicators you see they gives the same results.

    Max

    test.png test.png
    #104173 quote
    VonasiVonasi
    Moderator
    Master

    …and the final test. All three in one indicator and output compared. They all do the same thing.

    //maximus
    a=close>close[1] and  close>close[2] and close>close[3] and close>close[4] and close>close[5]
    
    if a then
    result=1
    else
    result=0
    endif
    
    //roberto
    IF close > highest[5](close[1]) THEN
    result2=1
    else
    result2=0
    endif
    
    //vonasi
    x = 5
    count = 0
    for i = 1 to x
    if close > close[i] then
    count = count + 1
    endif
    next
     
    result3 = 0
    if count = x then
    result3 = 1
    endif
    
    //final check
    result4 = result + result2 + result3
    
    flag = 0
    if result4 <> 0 and result4 <> 3 then
    flag = 1
    endif
    
    return flag
    #104183 quote
    GraHalGraHal
    Participant
    Master

    HAHAHAHA … and all that sleep you lost / nightmares Vonasi! 🙂

    Just shows … more than one way to splice the mainbrace eh!

    #104185 quote
    VonasiVonasi
    Moderator
    Master

    more than one way to splice the mainbrace eh!

    …or more than one way to skin a cat….. or more than one way to trip over it in Roberto’s case! 🙂

    #104186 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Yes, the first 3 snippets yield the same results, but not my 4th one (summation).

    So this one is the incorrect one.

    x-1.jpg x-1.jpg
    #104192 quote
    VonasiVonasi
    Moderator
    Master

    but not my 4th one (summation).

    Thank God one of us has finally confirmed that we were wrong – even if it was only 50% wrong! 🙂

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Code of series of periods


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
maximus78 @maximus78 Participant
Summary

This topic contains 24 replies,
has 5 voices, and was last updated by VonasiVonasi
7 years, 1 month ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/06/2018
Status: Active
Attachments: 3 files
ProRealCode ProRealCode
Loading...