Trouble implementing WidgetRules?

Custom indicators, trading strategies, data export and recording and more...
dmavro
Posts: 52
Joined: Thu Sep 24, 2020 9:20 pm
Been thanked: 1 time

Trouble implementing WidgetRules?

Post by dmavro » Tue Jun 15, 2021 4:24 pm

Im having an issue implementing setWidgetRules for my addons. Im trying to turn off the widget display for the plots in my addon that way i dont have to manually turn them off when i enable my addons for the 1st time. I tried to use code that i found in this forum post.

I tried to implement it in my initialize code like this....  

Indicator Indicator = api.registerIndicator("fstPctLvl ", GraphType.PRIMARY, Double.NaN, true, false);

and i also tried it like this....

private IndicatorModifiable fstPctLvl ;
fstPctLvl = api.registerIndicatorModifiable ("fstPctLvl ", GraphType.PRIMARY, Double.NaN, true, false);

but i cant seem to get it to work. I keep getting this error ...

The method registerIndicator(String, Layer1ApiUserMessageModifyIndicator.GraphType, double) in the type Api is not applicable for the arguments (String, Layer1ApiUserMessageModifyIndicator.GraphType, double, boolean, boolean)


Any help would be appreciated.

Thanks,
Dean 

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: Trouble implementing WidgetRules?

Post by Andry API support » Wed Jun 16, 2021 7:42 am

Hi Dean,
I need to see your build.gradle file. It is in your project folder.

dmavro
Posts: 52
Joined: Thu Sep 24, 2020 9:20 pm
Been thanked: 1 time

Re: Trouble implementing WidgetRules?

Post by dmavro » Fri Jun 18, 2021 1:13 am

Andrey,

Here are the contents of the file....

Code: Select all

 
apply plugin: 'java'
apply plugin: 'eclipse'

repositories {
    mavenCentral()
    maven {
        url "https://maven.bookmap.com/maven2/releases/"
    }
}

eclipse.classpath.downloadJavadoc = true

dependencies {
    compileOnly group: 'com.bookmap.api', name: 'api-core', version: '7.1.0.66';
    compileOnly group: 'com.bookmap.api', name: 'api-simplified', version: '7.1.0.66';
 
    //compile group: 'com.opencsv', name: 'opencsv', version: '5.3'  
    implementation group: 'com.opencsv', name: 'opencsv', version: '5.3'
}

Thanks,
Dean

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: Trouble implementing WidgetRules?

Post by Andry API support » Fri Jun 18, 2021 8:03 am

Hi Dean,
1) what Bookmap version are you running?
2) do you have this error in runtime (when using your strategy) or in compile time (in your IDE)?

dmavro
Posts: 52
Joined: Thu Sep 24, 2020 9:20 pm
Been thanked: 1 time

Re: Trouble implementing WidgetRules?

Post by dmavro » Fri Jun 18, 2021 7:17 pm

AndreyR wrote:
Fri Jun 18, 2021 8:03 am
Hi Dean,
1) what Bookmap version are you running?
2) do you have this error in runtime (when using your strategy) or in compile time (in your IDE)?

Hi Andrey,

Im running 7.2.0 build 16. I get the error in Eclipse as soon as i write the code.

Thanks,
Dean

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: Trouble implementing WidgetRules?

Post by Andry API support » Mon Jun 21, 2021 10:07 am

please change the api- libs in your build.gradle to 7.2.0.16 and rebuild your project

Code: Select all

dependencies {
    compileOnly group: 'com.bookmap.api', name: 'api-core', version: '7.2.0.16';
    compileOnly group: 'com.bookmap.api', name: 'api-simplified', version: '7.2.0.16';

dmavro
Posts: 52
Joined: Thu Sep 24, 2020 9:20 pm
Been thanked: 1 time

Re: Trouble implementing WidgetRules?

Post by dmavro » Mon Jun 21, 2021 3:08 pm

Andrey,

That fixed issue. Thank you. I had this issue once before with something else which forced me to change to the version i had been using.

Question....
In the future should i just always make sure my api-libs for any addons in development match my current Bookmap version? Or do the API versions not change with every new build of Bookmap?


Thanks,
Dean

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: Trouble implementing WidgetRules?

Post by Andry API support » Tue Jun 22, 2021 10:45 am

Sometimes they do. It is better to keep the same version of Bookmap and api libs.

Svyatoslav
Site Admin
Posts: 278
Joined: Mon Jun 11, 2018 11:44 am
Has thanked: 2 times
Been thanked: 31 times

Re: Trouble implementing WidgetRules?

Post by Svyatoslav » Tue Jun 22, 2021 2:20 pm

Normally, we only add features and try to avoid breaking compatibility. So you typically want to develop for the lowest supported version of API (e.g if you intend your addon to run starting with 7.1.0 build 14, then you want api libs of version 7.1.0.14). That helps you avoid a situation where you accidentally start relying on newer functionality, making it impossible for users with older bookmap builds to run your addon.

Post Reply