API Support Forum
OEC API > API Support > BarInterval property seems to have incorrect data (Custom Indicator)
Author Topic: BarInterval property seems to have incorrect data (Custom Indicator)
(2 messages, Page 1 of 1)
Moderators: VPfau
JCarey1693
Posts: 5
Joined: Oct 27, 2015


Posted: Oct 27, 2015 @ 01:43 PM             Msg. 1 of 2
In my custim indicator .CS code:

The BarInterval property doesn't seem to be acting right. BarType is giving 1 and 2 fine for minute charts and daily and monthly. The problem lies in the BarInterval property. If it's a daily chart, BarType returns 2 like the doc said and BarInterval returns 1, like normal. Weekly charts return Bartype 2 and BarInterval 1 again. Monthly returns BarInterval 1 as well.

For instance I am writing this to the log:

Log.WriteLine("BarInt is: " + CustomIndicatorInternal.CurrentContext.BarInterval + ", and BarType is: " + CustomIndicatorInternal.CurrentContext.BarType);

And for monthly and weekly charts using ESZ5, I'm getting logs of "BarInt is: 1, and BarType is: 2"

Am I doing this wrong or is there a bug somewhere?

Thanks

John Carey
VPfau
Moderator
Posts: 164
Joined:


Posted: Oct 29, 2015 @ 10:41 AM             Msg. 2 of 2
Hello,

We have a minor issue with BarInterval and going to fix this with next release.

But we keep these two properties for EasyLanguage compatibility. If you are using CS code, why don't you use Indicator.CurrentTimeframe? It provides rich functionality for bar interval.

Timeframe struct represents BarUnit and Size; See doc at plugin installation folder {OEC Installation path}\Plugins\{demo|prod|api}\CustomIndicators\help\OECCharts.chm

Vitaliy Pfau