DAS Trader Pro Advanced Hotkeys part 58
How to find a price range between specific times of the day
Find a price range between specific times of the day
Let’s say it is 1PM and we need to know what was the range today from 4 AM till 8 AM
First we need to determine todays date, then we can use the date to address specific candle on the highest time-frame chart that we have and that would answer the question. In this case it is 60 min chart as we are interested in the whole hours range.
Then we declare the first candle LOW as the minumum $LOW and HIGH as maximum $HIGH.
After that we compare the following candles if their LOW and HIGH is lower or higher. If they are, we swap the $LOW value for the newly found LOW and $HIGH for HI.
$TODAYSDATE=SUBSTRING(getwindowobj("MY1MIN").getbar(0).time,0,8);
$LOW=getwindowobj("MY60MIN").getbar($TODAYSDATE+" 04:00:00").lo;
if(getwindowobj("MY60MIN").getbar($TODAYSDATE+" 05:00:00").lo<$LOW)
{$LOW=getwindowobj("MY60MIN").getbar($TODAYSDATE+" 05:00:00").lo;}
if(getwindowobj("MY60MIN").getbar($TODAYSDATE+" 06:00:00").lo<$LOW)
{$LOW=getwindowobj("MY60MIN").getbar($TODAYSDATE+" 06:00:00").lo;}
if(getwindowobj("MY60MIN").getbar($TODAYSDATE+" 07:00:00").lo<$LOW)
{$LOW=getwindowobj("MY60MIN").getbar($TODAYSDATE+" 07:00:00").lo;}
$HIGH=getwindowobj("MY60MIN").getbar($TODAYSDATE+" 04:00:00").hi;
if(getwindowobj("MY60MIN").getbar($TODAYSDATE+" 05:00:00").hi>$HIGH)
$HIGH=getwindowobj("MY60MIN").getbar($TODAYSDATE+" 05:00:00").hi;
if(getwindowobj("MY60MIN").getbar($TODAYSDATE+" 06:00:00").hi>$HIGH)
$HIGH=getwindowobj("MY60MIN").getbar($TODAYSDATE+" 06:00:00").hi;
if(getwindowobj("MY60MIN").getbar($TODAYSDATE+" 07:00:00").hi>$HIGH)
$HIGH=getwindowobj("MY60MIN").getbar($TODAYSDATE+" 07:00:00").hi;
$RANGE=ABS($HIGH-$LOW);
Our final range value is the absolute value of the difference (substraction) between the two values found.
I chose this method over the looping the time and adding 1 hour to the time of the day as this is very readable. For more modular use for example on lower time frame charts, we could still use the looping like this.
Keep reading with a 7-day free trial
Subscribe to Peter’s Substack to keep reading this post and get 7 days of free access to the full post archives.