Highest/Lowest price after defined time

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #114386 quote
    Thally
    Participant
    Average

    Hi folks,

    I wonder if anyone can help. Ive been banging my head against my desk for hours trying to figure this one out…

    Instead of identifying the highest high or lowest low over a lookback period of given number of bars – e.g.

    HIGHEST[10](High)

    I would like to quantify the highest high and lowest low after a defined time. For example, I’d like to quantify the highest high after 14:00 and before 19:00

    This quantity should continually update during this period but not reference price prior to 14:00. This is where the HIGHEST[10](High) is problematic because at 14:00 it is looking 10 bars back before the time reference point.

    Thanks in advance for any help

    #114389 quote
    robertogozzi
    Moderator
    Master

    Try this (not tested):

    IF OpenTime = 140000 Then
       MyHighest = high
    Endif
    If OpenTime > 140000 and OpenTime <= 160000 Then
       MyHighest = max(MyHighest,high)
    Endif

    You can replace OpenTime with Time if you prefer the time when a candle closes rather than when it opens.

    Moreover, it will not work as expected if you use a TF that does not open/close a candle at that time (such as a 4-hour or 7-minute TF).

    Thally thanked this post
    #114391 quote
    Thally
    Participant
    Average

    Many thanks Roberto. Thats spot on!

    #114392 quote
    robertogozzi
    Moderator
    Master

    Sorry for not adding LOWEST.

    I read your example and didn’t pay attention to your title:

    IF OpenTime = 140000 Then
       MyHighest = high
       MyLowest  = low
    Endif
    If OpenTime > 140000 and OpenTime <= 160000 Then
       MyHighest = max(MyHighest,high)
       MyLowest  = min(MyLowest,low)
    Endif
    #114396 quote
    GraHal
    Participant
    Master

    Added as Log 188 here

    Snippet Link Library

    robertogozzi thanked this post
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Highest/Lowest price after defined time


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Thally @rodger_dodger Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by GraHal
6 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/07/2019
Status: Active
Attachments: No files
Logo Logo
Loading...