Help Button

To add comments, please log in or register
texoro
191
texoro  
Hi guys, I created a button object for a marker (the code is below), when I "press it" It is all right and it executes the part of the code " //Button is pressed ", the problem is when I "resume" that should execute the part of the code " //Button is not pressed " instead it executes only " Print ("hello");" in fact in the "advisors tab" appears "hello", how come, where I went wrong.

This button panel is used to show various things on the chart, one of these is to mark the min and max monthly, now, if I click the button and change TF, the button "remains clicked" but the min/max monthly is deleted on the chart, how should I do to avoid the deletion?

void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam){


  if(id==CHARTEVENT_OBJECT_CLICK){
      //--- If you click on the object with the name buttonID
    if(sparam=="MaxMinAnnu") //Button is pressed
        {
         //--- State of the button - pressed or not
         if(ObjectGetInteger(0,"MaxMinAnnu",OBJPROP_STATE)==true)
           {
            if(barre<Bars)
            {
               barre=Bars;           
               show_max_12MN=true; 
               show_min_12MN=true; 
               drawAll(); 

           }

         else// Button is not pressed
           {
           ObjectDelete(0,"max_1MN");
           Print("ciao");

           }
          }
      ChartRedraw();
      } 
To add comments, please log in or register