Re: Indicators with ON/OFF buttons

203
Hey Banzai,

Having multiple buttons with the new code, make the previous button disappear. It seems they are all using the same button ID. What do you think? I tried to modify the "buttonid = id" but I got a compiling error. Maybe the button id can be set as an extern variable to keep them unique?

Edit: just tried to set the button id as an extern variable and that didnt work. It seems multiple buttons will conflict with each other.
Banzai wrote: Sat Jul 11, 2020 6:07 pm

Re: Indicators with ON/OFF buttons

205
Lumios wrote: Sun Jul 12, 2020 12:59 am Hey Banzai,

Having multiple buttons with the new code, make the previous button disappear. It seems they are all using the same button ID. What do you think? I tried to modify the "buttonid = id" but I got a compiling error. Maybe the button id can be set as an extern variable to keep them unique?

Edit: just tried to set the button id as an extern variable and that didnt work. It seems multiple buttons will conflict with each other.
First, I got the button code from Mario Jemic.

By comparing the two files, we can make a template to copy and paste.


Re: Indicators with ON/OFF buttons

206
Attached is a naked template.

So in the extern section, we make a UniqueButtonID

Code: Select all

extern string             UniqueButtonID        = "Mando";
and then in the Init section, we change the template a little bit.

Code: Select all

int init() //don't change anything here
  {
   IndicatorName = GenerateIndicatorName(UniqueButtonID); 
   IndicatorObjPrefix = "__" + IndicatorName + "__";
   IndicatorShortName(IndicatorName);
   IndicatorDigits(Digits);
   visibility.Init("show_hide_"+UniqueButtonID, IndicatorName, btn_text, button_x, button_y);

//DON'T put the init function here

   return 0;
};
These users thanked the author Banzai for the post (total 3):
Lumios, rudiarius, Thangarasu

Re: Indicators with ON/OFF buttons

209
There was an issue with the new format on day separator and new format on auto pivot. My mind is blank too haha
Banzai wrote: Sun Jul 12, 2020 3:17 am Attached is a naked template.

So in the extern section, we make a UniqueButtonID

Code: Select all

extern string             UniqueButtonID        = "Mando";
and then in the Init section, we change the template a little bit.

Code: Select all

int init() //don't change anything here
  {
   IndicatorName = GenerateIndicatorName(UniqueButtonID); 
   IndicatorObjPrefix = "__" + IndicatorName + "__";
   IndicatorShortName(IndicatorName);
   IndicatorDigits(Digits);
   visibility.Init("show_hide_"+UniqueButtonID, IndicatorName, btn_text, button_x, button_y);

//DON'T put the init function here

   return 0;
};


Who is online

Users browsing this forum: ChatGPT [Bot], DotNetDotCom [Bot], ffsss, gmpleyland, Majestic-12 [Bot], sdsdzk, Tradehunter, TransparentTrader and 121 guests