ComboBox works on Indicator but not on EA ! What's wrong with this code ?

 

Hello Everyone,

Here is the code for the ComboBox (MT4). It work on the indicator but not on Expert advisor ? I wonder why !


I have two questions:

1-How to make a ComboBox in the EA ?

2-How to select an option from the ComboBox's list ?


Thank you very much


#include <Controls\ComboBox.mqh> 


CComboBox combox;



int OnInit()

  {


   ChartSetInteger(NULL,CHART_EVENT_MOUSE_MOVE, true);

   ChartSetInteger(NULL,CHART_EVENT_OBJECT_CREATE,true);

   ChartSetInteger(NULL,CHART_EVENT_OBJECT_DELETE, true);

      

    combox.Create(0,"Options",0,200,40,500,70);

    combox.AddItem("Option 0",0);    

    combox.AddItem("Option 1",1);

    combox.AddItem("Option 2",2);

    combox.AddItem("Option 3",3);

    combox.AddItem("Option 4",4);

    combox.AddItem("Option 5",5);

    

    combox.Select(2);


//---

   return(INIT_SUCCEEDED);

  }


void OnChartEvent(const int id,

                  const long &lparam,

                  const double &dparam,

                  const string &sparam)

  {

//---

    combox.OnEvent(id,lparam,dparam,sparam);

    }

//+------------------------------------------------------------------+



 
TomQL:

Hello Everyone,

Here is the code for the ComboBox (MT4). It work on the indicator but not on Expert advisor ? I wonder why !


Was the market closed when you tried to test your EA?

 
nicholishen:

Was the market closed when you tried to test your EA?


No it was still open when I tested it.