Yesterday's High is today's absolute low :(

Spin

Well-known member
Joined
May 22, 2019
Posts
484
Likes
194
Hello fellow coders,

Another day and sadly another MW-quirk.

For a client's Study I need Yesterday's High and Yesterday's Low, so I coded them up (using blue horizontal lines to visualize them) and this is the result on a Daily chart:

265

The Study's log now looks like this:

267
So far so good ! :)

And then I adjust the barsize, to a value smaller than Daily, and the whole Study starts flipping: the values of Yesterday's High / Low do not even correspond remotely to what they should be (you can tell by the blue lines hovering way too high above the price level):

266

I have no clue whatsoever as to why this is happening. My Study log still uses the same times as Yesterday's begin and end time, but the values are waaaay higher than they should be.

Has anyone experienced the same behavior, had to fight the same struggle ?

Perhaps this can help: I noticed this piece of code in MW's native PivotPoint-Study:
Java:
if (barSize.isLinear() && barSize.getIntervalMinutes() >= 1440) {
        // This is a bit of a hack.
        // If the trading hours are off by a little bit, its possible that the time from the daily bar
        // is actually on the previous day.  Add a bit of time here to work around
          time = instr.getStartOfDay(time + 6*Util.MILLIS_IN_HOUR, ctx.isRTH());
          if (ctx.isRTH() && time < series2.getStartTime(i) - 6*Util.MILLIS_IN_HOUR) time += Util.MILLIS_IN_DAY;
        end = time + barSize.getSizeMillis(); // Adjust the end here to make sure we have no overlap
      }

Could this be the same issue as the one I am facing ?

Thanks in advance for all help ! :)

PS: I started out by trying to use this part of the MW-SDK:
https://www.motivewave.com/sdk/java...ewave.platform.sdk.common.Instrument,boolean)
but I get compilation errors. I believe there is a typo in the SDK-code somewhere, because that method cannot be called
 
Last edited:

MotiveWave_Joe

Moderator
Staff member
Joined
Mar 26, 2019
Posts
223
Likes
67
Hi Spin,

Take a look at the source for the OHLC study. I tried plotting different intraday timeframes with the previous high and previous low selected and it seems to work fine across intraday timeframes. Perhaps something in the source will stand out.
 

Spin

Well-known member
Joined
May 22, 2019
Posts
484
Likes
194
Hey Joe,

Thanks for trying to help out ! (y)

Is it possible that the OHLC is not included in the downloadable "All 275 MW Studies" ??

I did a search in my IDE (Eclipse), but no results. I noticed that OHLC is part of the 'Overlays' submenu in MW, but I cannot spot it in that folder either:
270

Finally, I also searched my Eclipse-workspace folder, but no luck there either :cautious:

On a sidenote: when I was searching for a solution to this 'Yesterday's High'-issue, I came across the "PrevPeriodRange"-Study. It seems that one never made it to the MW-platform. Can you tell us why ?

Thanks again !
 

MotiveWave_Joe

Moderator
Staff member
Joined
Mar 26, 2019
Posts
223
Likes
67
Hi Spin,

No problem. I downloaded the source zip found in the following thread and those two seem to be there in the overlay folder:

 

Attachments

  • source.png
    source.png
    55.7 KB · Views: 15

Spin

Well-known member
Joined
May 22, 2019
Posts
484
Likes
194
And indeed they are present in that zip-file !

I have a sneaky suspicion that this is a newer zip-file, containing more than the one I downloaded back in the spring of 2019. The filename gave it away ;) I should have checked whether or not there was a newer version. Lazy me :sleep:


Anyway: I will look at that OHLC-study and try to benefit from it !

Thanks a lot @MotiveWave_Joe !
 

samy2006

Member
Joined
Sep 16, 2022
Posts
19
Likes
1
Can anyone tell me why OHLC does not show yesterday's high and low in the daily chart but only in the timeframe below?
 

Spin

Well-known member
Joined
May 22, 2019
Posts
484
Likes
194
I'm afraid it is programmed to do so, @samy2006 :

1692274679503.png

(translation: "If TimeFrame is greater than 1440 minutes, set a boolean 'clear' to true. And later, if that boolean 'clear' is true, then clear all lines")

You would need to custom-code it for not to do that and show you daily lines on a daily chart (would be short lines though !)
 
Top