Przypuszczam, że jemu chodzi, żeby ktoś mu guziki napisał.AK53 pisze:Wciśnij trójkąt koło nazwy pary. Wersja 1090 ma to.marcin76 pisze:Witam
Poszukuje prostego EA z 2 przyciskami BUY i SELL , aby można było otwierać pozycje po naciśnięciu przycisku albo BUY SELL ale w pliku MQL4
pozdrawiam
A on chce sobie inne warunki sam dopisać.
Ale guzik jest obecnie łatwo napisać w mql4 (OBJ_BUTTON).
Kod: Zaznacz cały
//+------------------------------------------------------------------+
void CreateButton()
{
if(ObjectFind(0,Symbol()+"SEM_Button")<0)
{
ObjectCreate(0,Symbol()+"SEM_Button",OBJ_BUTTON,Button_Window,0,0);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_XDISTANCE,Button_X);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_YDISTANCE,Button_Y);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_XSIZE,27);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_YSIZE,27);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_CORNER,3);
ObjectSetString(0,Symbol()+"SEM_Button",OBJPROP_TEXT," SE");
ObjectSetString(0,Symbol()+"SEM_Button",OBJPROP_FONT,"Tahoma");
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_FONTSIZE,9);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_COLOR,Off_Txt_Color);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_BGCOLOR,Off_Bg_Color);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_BORDER_COLOR,Off_Brdr_Color);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_BACK,false);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_STATE,false);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_SELECTABLE,false);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_SELECTED,false);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_HIDDEN,true);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_ZORDER,9);
}
}
//+------------------------------------------------------------------+
void OnChartEvent(const int id, // Event identifier
const long& lparam, // Event parameter of long type
const double& dparam, // Event parameter of double type
const string& sparam) // Event parameter of string type
{
if(id==CHARTEVENT_OBJECT_CLICK)
{
double SEM_ON = GlobalVariableGet(Symbol()+"SEM_ON");
if(sparam==Symbol()+"SEM_Button"&&SEM_ON==0)
{
GlobalVariableSet(Symbol()+"SEM_ON",1);
SetButtonState();
}
if(sparam==Symbol()+"SEM_Button"&&SEM_ON==1)
{
GlobalVariableSet(Symbol()+"SEM_ON",0);
SetButtonState();
}
WindowRedraw();
ChartRedraw();
}
}
//+------------------------------------------------------------------+
void SetButtonState()
{
if(GlobalVariableCheck(Symbol()+"SEM_ON"))
{
if(GlobalVariableGet(Symbol()+"SEM_ON")==1)
{
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_BGCOLOR,On_Bg_Color);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_BORDER_COLOR,On_Brdr_Color);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_COLOR,On_Txt_Color);
}
if(GlobalVariableGet(Symbol()+"SEM_ON")==0)
{
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_BGCOLOR,Off_Bg_Color);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_BORDER_COLOR,Off_Brdr_Color);
ObjectSetInteger(0,Symbol()+"SEM_Button",OBJPROP_COLOR,Off_Txt_Color);
}
}
}
//+------------------------------------------------------------------+