Highest high and highest low of previous days and of specific schedules

Viewing 15 posts - 1 through 15 (of 39 total)
  • Author
    Posts
  • #81236 quote
    PVPRO
    Participant
    Junior

    Team

    Can anyone help me to get  code following requirement for time frame of 30 Minutes.

    1 ) Highest of high of previous day bars for trading duration of 10.00 Am to 16.00PM

    2) Lowest of lows of previous day bars for trading duration of 10.00 Am to 16.00PM

    3) Highest of high of a day before previous day bars for trading duration of 10.00 Am to 16.00PM

    4) Lowest of lows of a the day before previous day bars for trading duration of 10.00 Am to 16.00PM

    5) same above information but for last 5 days.

    Thanks.

    #81251 quote
    Nicolas
    Keymaster
    Master

    This little snippet will plot lines for the last 5 days highest high and lowest low, calculated in a specific time range:

    starthour = 100000
    endhour = 160000
    
    count = today-date
    
    tcondition = time>=starthour and time<=endhour 
    
    if count<=5 and count>0 then 
    if tcondition then 
    hh=max(hh,high)
    ll=min(ll,low)
    endif
    if tcondition[1] and not tcondition then 
    drawhline(hh) coloured(0,255,0)
    drawhline(ll) coloured(255,0,0)
    hh=0
    ll=close*1000
    endif
    endif
    
    return
    #81284 quote
    PVPRO
    Participant
    Junior

    Thanks a lot Nicolas.

    I will run the code & update you.

    Thanks.

    #81297 quote
    PVPRO
    Participant
    Junior

    Hi Nicolas

    I pasted above code in Indicator & trading system – Indicator – New. Then added this indicator to US500 but I could not see any indicator. I mean I did not get any result.

    aslo tried to use it code for strategy, but did not get any result.  Appreciate if you could you please check at your end & guide me.

    I actually need to use in the strategy for auto  trading. So please advice.

    Thanks.

    #81300 quote
    PVPRO
    Participant
    Junior

    Can I also know code for 1 day before yesterday? 2 day before yesterday? and so on?

    Thanks.

    #81304 quote
    Vonasi
    Moderator
    Master

    I pasted above code in Indicator & trading system – Indicator – New. Then added this indicator to US500 but I could not see any indicator. I mean I did not get any result.

     

    Click on the spanner in the corner of the chart that you want to add it to and add it directly to the chart rather than as a separate indicator window.

    #81366 quote
    Nicolas
    Keymaster
    Master

    The code I made is working for the 5 previous days, as the way you wanted it to be. But I also realize that it would also count the weekend as trading days .. Tell me if it’s working as intended and then I’ll try to change the code to work around this problem.

    #81383 quote
    PVPRO
    Participant
    Junior

    Hi Nicolas

    I used this code to program indicator and then tried adding it to the chart. But no results. I am new to Prorealtime. Appreciate if you.  let me know the exact steps to follow. I am using 30min chart set for UK time (custom trading hours) i.e. 14.30 to 21.00 UK time for US500 chart.

    Thanks.

    #81414 quote
    Nicolas
    Keymaster
    Master

    The indicator doesn’t return any values but plot lines across the price chart. Please add it on price like the way Vonasi has told you. Example attached right now on DAX and SP500.

    #81590 quote
    PVPRO
    Participant
    Junior

    Hi Nicolas and Vonasi

    Unfortunately I am unable to do and achieve what you advised. This is because I am too new to Prorealtime.

    1. Please advice on stpes to get screen shots as per proreI am not interealtime forum requirement so that I can forward to step wise screen shots of what am doing wha6 what I get.

    You certainly will then find out what wrong I am doing.

    2 I am not interested in showing my original requirement (lowest low  & highest high of of last 5 days for specific time frame) on chart. I need code for it to use those value in trading strategy. Appreciate to have the code to get that information.  If you ue Graph function to get those value it will be useful for me to verify the results.

    Thanks

    #81593 quote
    Vonasi
    Moderator
    Master

    I am not interested in showing my original requirement (lowest low  & highest high of of last 5 days for specific time frame) on chart. I need code for it to use those value in trading strategy.

    You have posted your request in the ProBuilder forum which is a forum to discuss indicators and not strategies. This is why Nicolas has provided code to display the lines on a chart as an indicator and not code that can be used in a strategy.

    Please try to post in the correct forum with future requests as it saves a lot of time and confusion.

    Topic now moved to the ProOrder forum.

    #81595 quote
    Vonasi
    Moderator
    Master

    You could try something like this in a strategy:

    starthour = 100000
    endhour = 160000
     
    if time = starthour then
    hh2 = hh1
    hh1 = hh
    hh = close
    ll2 = ll1
    ll1 = ll
    ll = close * 1000
    endif
    
    if time >= starthour and time <= endhour then
    hh = max(hh, high)
    ll = min(ll, low)
    endif
    

    HH1 = highest high 1 day ago between start time and finish time

    LL1 = lowest low 1 day ago between start time and finish time

    HH2 = highest high 2 days ago between start time and finish time

    LL2 = lowest low 2 days ago between start time and finish time

    Only works on 1 hour or faster charts.

    #81610 quote
    PVPRO
    Participant
    Junior

    Hi Vonasi

    It is working. Great. Thanks a lot.

    Could you please further advice on code modification for below modified requirement.

    HH1 = highest high 1 day ago between start time = a and finish time = b

    LL1 = lowest low 1 day ago between start time = a  and finish time  = b

    HH2 = highest high 2 days ago between start time = c and finish time d

    LL2 = lowest low 2 days ago between start time = c and finish time = d

    I mean HH1, LL1 and HH2 LL2 for different time frames for previous & day before previous.

    Thanks.

    #81611 quote
    Vonasi
    Moderator
    Master

    Just put two versions of the same code in your strategy but modify the variable names in the second version then you can select whichever set of results from each day that you want.

    starthour = 100000 //a
    endhour = 160000 //b
     
    if time = starthour then
    hh2 = hh1
    hh1 = hh
    hh = close
    ll2 = ll1
    ll1 = ll
    ll = close * 1000
    endif
     
    if time >= starthour and time <= endhour then
    hh = max(hh, high)
    ll = min(ll, low)
    endif
    
    starthour2 = 110000 //c
    endhour2 = 150000 //d
     
    if time = starthour2 then
    2hh2 = 2hh1
    2hh1 = 2hh
    2hh = close
    2ll2 = 2ll1
    2ll1 = 2ll
    2ll = close * 1000
    endif
     
    if time >= starthour2 and time <= endhour2 then
    2hh = max(2hh, high)
    2ll = min(2ll, low)
    endif

    HH1 = highest high 1 day ago between start time = a and finish time = b

    LL1 = lowest low 1 day ago between start time = a  and finish time  = b

    2HH2 = highest high 2 days ago between start time = c and finish time d

    2LL2 = lowest low 2 days ago between start time = c and finish time = d

    #81858 quote
    PVPRO
    Participant
    Junior

    Hi Vonasi

    It is working. Thanks a lot for your support.

    I am working on strategy. I have selected US500 with custom trading hours (143000 – 210000) UK time as seen on my charts in UAE.

    The condition satisfied end of the day at 210000, open a trade at 120000 midnight UK time instead of opening next day at 1430000.

    I want that condition satisfied end of the day on custom trading hours (in my case at 210000 UK time) to open trade next day at opening of customer trading hours (in my case at 1430000 UK time).

    Can you please advice on code to achieve above requirement.

    Thanks.

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

Highest high and highest low of previous days and of specific schedules


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
PVPRO @pvpro Participant
Summary

This topic contains 38 replies,
has 6 voices, and was last updated by robertogozzi
6 years, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/24/2018
Status: Active
Attachments: 2 files
Logo Logo
Loading...