Is there any way to code and find out the timestamp?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #188776 quote
    Suzu Yuk
    Participant
    Average
    Hello,
    Does anyone know how to scan the highest high and lowest low cycle frequency is getting shorter or longer? Please see attached picture.
    I would like to find a timestamp (say X1, X2, X3,,,,,) for each highest high and lowest low. Then (X2 – X1) can tell us how long it took to make each price cycle. By comparing  (X2 – X1)  and  (X3 – X2), I can say whether the price cycle is getting longer or shorter.
    Regards,
    IMG_20220224_160307.jpg IMG_20220224_160307.jpg
    #188785 quote
    robertogozzi
    Moderator
    Master

    Try this (not tested):

    p  = 40
    x3 = highest[p](high)
    x2 = highest[p](high[p])
    x1 = highest[p](high[p * 2])
    For i = (p*3)-1 downto (p*2)
       if high[i] = x1 then
          b1 = BarIndex[i]
          Break
       Endif
    Next
    For i = (p*2)-1 downto p
       if high[i] = x2 then
          b2 = BarIndex[i]
          Break
       Endif
    Next
    For i = p-1 downto 0
       if high[i] = x3 then
          b3 = BarIndex[i]
          Break
       Endif
    Next
    x1x2 = b2 - b1
    x2x3 = b3 - b2
    x = 0
    If x1x2 > x2x3 then
       x = 1
    Elsif x1x2 < x2x3 then
       x = 2
    Endif
    Screener[x](x as “1=x1x2,  2=x2x3")
    #188789 quote
    Nicolas
    Keymaster
    Master

    The new instruction HighestBars could help in this case.

    #188803 quote
    robertogozzi
    Moderator
    Master

    This is the code with the new instruction suggested by Nicolas:

    p  = 40
    b3 = highestbars[p](high)
    b2 = highestbars[p](high[p])
    b1 = highestbars[p](high[p * 2])
    x1x2 = b2 - b1
    x2x3 = b3 - b2
    x = 0
    If x1x2 > x2x3 then
       x = 1
    Elsif x1x2 < x2x3 then
       x = 2
    Endif
    Screener[x](x as “1=x1x2,  2=x2x3")
    #189153 quote
    Suzu Yuk
    Participant
    Average

    Thank you very much for your swift reply. I have been tucking to understand the following part of the previously mentioned solution by dissecting the last few days. However, I am still stuck with understanding the below:

    b3 = highestbars[p](high) b2 = highestbars[p](high[p])

    I understand “b3 = highestbars[p](high),” but I am not sure if I understand “b2 = highestbars[p](high[p]).” Why :[p](high[p]?” Why “p” in those two places?

    In order to dissect  and understand them on cash 500, ticker “SPTRD,” I program them to print out the code with two variable periods “p1” and “p2.”

    p1=4
    p2=4
    b3 = highestbars[p1](high)
    DRAWTEXT("#b3#", barindex, high+range*2, Dialog, Standard, 10) COLOURED(255,0,0)
    b2 = highestbars[p1](high[p2])
    //DRAWTEXT("#Hp2#", barindex, high+range*0.6, Dialog, Standard, 12)
    DRAWTEXT("#b2#", barindex, high+range*1.4, Dialog, Standard, 12)COLOURED(0,0,0)
    b1 = highestbars[p1](high[p2 * 2])
    //x1x2 = b2 - b1
    //x2x3 = b3 - b2
    //x = 0
    //If x1x2 > x2x3 then
    //x = 1
    //Elsif x1x2 < x2x3 then
    //x = 2
    //Endif
    return
    

    If anyone can possibly rephrase them in words, I would highly appreciate it very much.

    #189164 quote
    robertogozzi
    Moderator
    Master

    This line will check a highest value among the latest p bars (from 0 to 39):

    highestbars[p](high)

    you need two prior additional ones to find all the three, one between bars 40-79 and the leftmost one between bars 80-119.

    You can evaluate the expressions within brackets to check that.

    #189225 quote
    Suzu Yuk
    Participant
    Average

    Thank you very much for your reply. In order to understand what is going on with the code, I quantified the changing output with the gradation of color on cash 500, ticker symbol “SPTRD, screenshot attached. Would anyone agree with me the below:

    The blue gradation seems to illustrate the price cycle to be getting shorter.

    The black gradation seems to illustrate the price cycle to be getting longer.

    I am not sure yet if I can conclude as the above. I appreciate it very much if I can hear how other people can observe this outcome? Thank you

    p=4
    b3 = highestbars[p1](high)
    //DRAWTEXT(“#b3#”, barindex, high+range*2, Dialog, Standard, 10) COLOURED(255,0,0)
    Hp2=high[p2]
    b2 = highestbars[p1](high[p1])
    //DRAWTEXT(“#Hp2#”, barindex, high+range*0.6, Dialog, Standard, 12)
    //DRAWTEXT(“#b2#”, barindex, high+range*1.4, Dialog, Standard, 12)COLOURED(0,0,0)
    b1 = highestbars[p1](high[p1 * 2])
    //DRAWTEXT(“#b1#”, barindex, high+range*0.7, Dialog, Standard, 12)COLOURED(0,0,255)
    x1x2 = b2 – b1
    x2x3 = b3 – b2
    x = 0
    If x1x2 > x2x3 then
    M1 = x1x2 – x2x3
    HiM1=highest[pM1](M1)
    DRAWTEXT(“▇”, barindex, 1.001*highest[Hip](high), Dialog, Standard, 12)COLOURED(0,0,255, 255*M1/HiM1)
    x = 1
    Elsif x1x2 < x2x3 then
    M2 = -x1x2 + x2x3
    HiM2=highest[pM1](M2)
    DRAWTEXT(“▇”, barindex, 1.002*highest[Hip](high), Dialog, Standard, 12)COLOURED(0,0,0, 255*M2/HiM2)
    x = 2
    Endif
    return

    Screenshot-2022-03-03-at-10.03.21.png Screenshot-2022-03-03-at-10.03.21.png
    #189229 quote
    Suzu Yuk
    Participant
    Average

     

    p1=170
    p2=170
    pM1=170
    Hip=211
    b3 = highestbars[p1](high)
    //DRAWTEXT("#b3#", barindex, high+range*2, Dialog, Standard, 10) COLOURED(255,0,0)
    Hp2=high[p2]
    b2 = highestbars[p1](high[p1])
    //DRAWTEXT("#Hp2#", barindex, high+range*0.6, Dialog, Standard, 12)
    //DRAWTEXT("#b2#", barindex, high+range*1.4, Dialog, Standard, 12)COLOURED(0,0,0)
    b1 = highestbars[p1](high[p1 * 2])
    //DRAWTEXT("#b1#", barindex, high+range*0.7, Dialog, Standard, 12)COLOURED(0,0,255)
    x1x2 = b2 - b1
    x2x3 = b3 - b2
    x = 0
    If x1x2 > x2x3 then
    M1 = x1x2 - x2x3
    HiM1=highest[pM1](M1)
    DRAWTEXT("▇", barindex, 1.001*highest[Hip](high), Dialog, Standard, 12)COLOURED(0,0,255, 255*M1/HiM1)
    x = 1
    Elsif x1x2 < x2x3 then
    M2 = -x1x2 + x2x3
    HiM2=highest[pM1](M2)
    DRAWTEXT("▇", barindex, 1.002*highest[Hip](high), Dialog, Standard, 12)COLOURED(0,0,0, 255*M2/HiM2)
    x = 2
    Endif
    return
    
    robertogozzi thanked this post
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

Is there any way to code and find out the timestamp?


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Suzu Yuk @suzu_yuk Participant
Summary

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

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 02/24/2022
Status: Active
Attachments: 2 files
Logo Logo
Loading...