High/low/open prices for specific timeframes

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #32800 quote
    Roman
    Participant
    Junior

    Hi, I am using v10.3. I need  an open price  at 08:00 and highest and lowest prices between 08:00 and 09:00 for N days.

    #32984 quote
    gabri
    Participant
    Master
    if time=080000 then
    initialOPEN=open
    endif
    once sup=0
    once infer=100000
    if time>=080000 and time <=090000 then
    if high>sup then 
    sup=high
    endif
    if low<infer then
    infer=low
    endif
    endif
    return initialOPEN, sup, infer
    #33069 quote
    Roman
    Participant
    Junior

    Hallo, gabri,

     

    thank you very much for your help!

    How can I calculate min and max for x = sup-initialOPEN and y = initialOPEN-infer as average values for 22 days?

    #33070 quote
    Roman
    Participant
    Junior

    Hallo, gabri,

    I have corrected the previous post:

    How can I calculate  x = sup-initialOPEN and y = initialOPEN-infer as average values for 22 days?

    #33079 quote
    gabri
    Participant
    Master

    I am not sure you can do that in an intraday window, sorry!!

    #33082 quote
    gabri
    Participant
    Master

    Roman, do you need a simple average and ONLY in one specific timeframe? If so tell me the timeframe and I might be able to do something.

    #33083 quote
    Roman
    Participant
    Junior

    Hi, gabri,

    For example: the average value as diffence between open price and highest price (highest price – open price)  between 080000 and 090000 (DL on the picture) for last 22 days and the avergae value as diffence between open price and lowest price (open price – lowest price) between 080000 and 090000 (DS on the picture) for last 22 days.

    #33117 quote
    gabri
    Participant
    Master

    Roman,

    if for you a Wilder Average is enough I can offer you this solution. If you need a standard average I need to come up with something more complex.

    //Timeframe used has to be less than 1 hr
    
    //definition open of the day
    initialopen=dopen(0)
    //computation max and min in the first hour - super e infer
    if (time>=090000) and (time<=100000) then
    super=dopen(0)
    infer=dopen(0)
    if high>super then
    super=high
    endif
    if low<infer then
    infer=low
    endif
    else
    super=super
    infer=infer
    endif
    //computation Wilder average of (super-initialopen) and (initialopen-infer)
    period=22
    once sommadeltasuper=0
    once sommadeltainfer=0
    if time=100000 then
    sommadeltasuper=((super-initialopen)+(sommadeltasuper*(period-1)))/period
    sommadeltainfer=((super-initialopen)+(sommadeltasuper*(period-1)))/period
    endif
    
    return sommadeltasuper,sommadeltainfer
    
    #33168 quote
    gabri
    Participant
    Master

    Roman,

    this is the code with simple moving average. Let me know how it work.

     

    //computation timeframe in use and intraday number of bars - intrab
    if intradaybarindex=0 then
    time1=opentime
    endif
    if intradaybarindex=1 then
    time2=opentime
    endif
    deltatime=(time2-time1)/100
    intrab=round(522/deltatime)
    //computation max and min in the first hour - super e infer
    if (time>=090000) and (time<=100000) then
    super=dopen(0)
    infer=dopen(0)
    if high>super then
    super=high
    endif
    if low<infer then
    infer=low
    endif
    else
    super=super
    infer=infer
    endif
    
    //computation average (super-initialopen) and (initialopen-infer)
    period=20
    if time=100000 then
    sommadeltasuper=0
    sommadeltainfer=0
    for i=0 to (period) do
    j=1+round(i*intrab)
    sommadeltasuper=sommadeltasuper+abs(super[j]-dopen(i))
    sommadeltainfer=sommadeltainfer+abs(dopen(i)-infer[j])
    next
    deltasuper=sommadeltasuper/period
    deltainfer=sommadeltainfer/period
    endif
    if time>100000 then
    up=super+deltasuper
    down=infer-deltainfer
    else
    up=up
    down=down
    endif
    
    
    
    return up,down
    
    Nicolas thanked this post
    #33169 quote
    gabri
    Participant
    Master

    With this last code you can directly insert the program over the price and see the lines.

    #33183 quote
    Roman
    Participant
    Junior

    Thank you, gabri,

     

    I’ll check it.

    #33274 quote
    gabri
    Participant
    Master

    Roman,

    take your time and check if the indicator works as needed. In case it gives the result you were looking for let me know so that I can post it also for the others.

    #33738 quote
    Roman
    Participant
    Junior

    Hallo, gabri,

    you can see attached results.  I used your Wilder’s Average. The idea was that in the premarket (08.00 – 09:00) the price often returns to the open price at 08:00. I don’t think the code can be improved, so I reject the idea.

    Thank you

     

    Roman

    #33745 quote
    gabri
    Participant
    Master

    Roman,

    I understand that the strategy you planned didn’t return the results you wanted. Was the indicator fulfilling your needs? did it show the data you needed?

     

    Gabriele

    #33747 quote
    Roman
    Participant
    Junior

    gabri,

     

    your indicator completely fulfilled my needs, thank you!

     

    Roman

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

High/low/open prices for specific timeframes


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Roman @roman Participant
Summary

This topic contains 16 replies,
has 2 voices, and was last updated by gabri
8 years, 9 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/20/2017
Status: Active
Attachments: 4 files
Logo Logo
Loading...