the same problem still persist. and i have added delete function. please help.
//+------------------------------------------------------------------+//| Test.mq4 |//| Copyright 2015, MetaQuotes Software Corp. |//| https://www.mql5.com |//+------------------------------------------------------------------+#property copyright"Copyright 2015, MetaQuotes Software Corp."#property link"https://www.mql5.com"#property version"1.00"#property strict#property indicator_chart_window//--- input parametersinputbool Alerts=TRUE;
//--- input parameters of the script inputstring InpNameUP="ArrowUp"; // Sign name UPinputstring InpNameDOWN="ArrowDown"; // Sign name DOWNinputENUM_ARROW_ANCHOR InpAnchorUP=ANCHOR_TOP; // Anchor type inputENUM_ARROW_ANCHOR InpAnchorDOWN=ANCHOR_BOTTOM; // Anchor type inputcolor InpColorUP=clrGreen; // Sign color UPinputcolor InpColorDOWN=clrRed; // Sign color DOWNinputENUM_LINE_STYLE InpStyle=STYLE_DOT; // Border line style inputint InpWidth=5; // Sign size inputbool InpBack=false; // Background sign inputbool InpSelection=false; // Highlight to move inputbool InpHidden=true; // Hidden in the object list inputlong InpZOrder=0; // Priority for mouse click //+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit(void)
{
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| expert start function |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime &time[],
constdouble &open[],
constdouble &high[],
constdouble &low[],
constdouble &close[],
constlong &tick_volume[],
constlong &volume[],
constint &spread[])
{
staticdatetime prev;
if(time[0]>prev) // new bar
{
//----if(Alerts)
{
if(close[4]>open[4] && close[3]>open[3] && close[2]>open[2] && close[1]<open[2])
{
string SELLSIGNAL=InpNameDOWN+(string)time[1];
ArrowDownCreate(0,SELLSIGNAL,0,time[1],high[1],InpAnchorDOWN,InpColorDOWN,InpStyle,
InpWidth,InpBack,InpSelection,InpHidden);
/*if(ObjectFind(0,SELLSIGNAL)!=0)
{
ObjectCreate(SELLSIGNAL,OBJ_ARROW_DOWN,0,time[1],low[1]);
ObjectSet(SELLSIGNAL,OBJPROP_WIDTH,5);
//ObjectSet(SELLSIGNAL,OBJPROP_ARROWCODE,242);
ObjectSet(SELLSIGNAL,OBJPROP_COLOR,clrRed);
ObjectSetInteger(0,SELLSIGNAL,OBJPROP_ANCHOR,ANCHOR_TOP);
}*/
}
else {
//--- delete the sign from the chart
ArrowUpDelete(0,InpNameDOWN);
ChartRedraw();
}
if(close[4]<open[4] && close[3]<open[3] && close[2]<open[2] && close[1]>open[2])
{
string BUYSIGNAL=InpNameUP+(string)time[1];
ArrowUpCreate(0,BUYSIGNAL,0,time[1],low[1],InpAnchorUP,InpColorUP,InpStyle,
InpWidth,InpBack,InpSelection,InpHidden);
/*if(ObjectFind(0,BUYSIGNAL)!=0)
{
ObjectCreate(BUYSIGNAL,OBJ_ARROW_UP,0,time[1],high[1]);
ObjectSet(BUYSIGNAL,OBJPROP_COLOR,clrBlue);
//ObjectSet(SELLSIGNAL,OBJPROP_ARROWCODE,241);
ObjectSet(BUYSIGNAL,OBJPROP_WIDTH,10);
ObjectSetInteger(0,BUYSIGNAL,OBJPROP_ANCHOR,ANCHOR_BOTTOM);
}*/
}
else {
//--- delete the sign from the chart
ArrowUpDelete(0,InpNameUP);
ChartRedraw();
}a
}
}
prev=time[0];
//----return(rates_total);
}
//+------------------------------------------------------------------+ //| Create Array Up sign | //+------------------------------------------------------------------+ bool ArrowUpCreate(constlong chart_ID=0, // chart's ID conststring name="ArrowUp", // sign name constint sub_window=0, // subwindow index datetime time=0, // anchor point time double price=0, // anchor point price constENUM_ARROW_ANCHOR anchor=ANCHOR_BOTTOM, // anchor type constcolor clr=clrRed, // sign color constENUM_LINE_STYLE style=STYLE_SOLID, // border line style constint width=3, // sign size constbool back=false, // in the background constbool selection=true, // highlight to move constbool hidden=true, // hidden in the object list constlong z_order=0) // priority for mouse click
{
//--- reset the error value ResetLastError();
//--- create the sign if(!ObjectCreate(chart_ID,name,OBJ_ARROW_UP,sub_window,time,price))
{
Print(__FUNCTION__,
": failed to create \"Arrow Up\" sign! Error code = ",GetLastError());
return(false);
}
//--- set anchor type ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor);
//--- set a sign color ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- set the border line style ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
//--- set the sign size ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width);
//--- display in the foreground (false) or background (true) ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- enable (true) or disable (false) the mode of moving the sign by mouse //--- when creating a graphical object using ObjectCreate function, the object cannot be //--- highlighted and moved by default. Inside this method, selection parameter //--- is true by default making it possible to highlight and move the object ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- hide (true) or display (false) graphical object name in the object list ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the priority for receiving the event of a mouse click in the chart ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful execution return(true);
}
//+------------------------------------------------------------------+ //| Create Array Down sign | //+------------------------------------------------------------------+ bool ArrowDownCreate(constlong chart_ID=0, // chart's ID conststring name="ArrowDown", // sign name constint sub_window=0, // subwindow index datetime time=0, // anchor point time double price=0, // anchor point price constENUM_ARROW_ANCHOR anchor=ANCHOR_BOTTOM, // anchor type constcolor clr=clrRed, // sign color constENUM_LINE_STYLE style=STYLE_SOLID, // border line style constint width=3, // sign size constbool back=false, // in the background constbool selection=true, // highlight to move constbool hidden=true, // hidden in the object list constlong z_order=0) // priority for mouse click
{
//--- reset the error value ResetLastError();
//--- create the sign if(!ObjectCreate(chart_ID,name,OBJ_ARROW_DOWN,sub_window,time,price))
{
Print(__FUNCTION__,
": failed to create \"Arrow Down\" sign! Error code = ",GetLastError());
return(false);
}
//--- anchor type ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor);
//--- set a sign color ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- set the border line style ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
//--- set the sign size ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width);
//--- display in the foreground (false) or background (true) ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- enable (true) or disable (false) the mode of moving the sign by mouse //--- when creating a graphical object using ObjectCreate function, the object cannot be //--- highlighted and moved by default. Inside this method, selection parameter //--- is true by default making it possible to highlight and move the object ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- hide (true) or display (false) graphical object name in the object list ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the priority for receiving the event of a mouse click in the chart ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful execution return(true);
}
//+------------------------------------------------------------------+//| Delete Arrow Up sign |//+------------------------------------------------------------------+bool ArrowUpDelete(constlong chart_ID=0, // chart's IDconststring name="ArrowUp") // sign name
{
//--- reset the error valueResetLastError();
//--- delete the signif(!ObjectDelete(chart_ID,name))
{
Print(__FUNCTION__,
": failed to delete \"Arrow Up\" sign! Error code = ",GetLastError());
return(false);
}
//--- successful executionreturn(true);
}
//+------------------------------------------------------------------+//| Delete Arrow Down sign |//+------------------------------------------------------------------+bool ArrowDownDelete(constlong chart_ID=0, // chart's IDconststring name="ArrowDown") // sign name
{
//--- reset the error valueResetLastError();
//--- delete the signif(!ObjectDelete(chart_ID,name))
{
Print(__FUNCTION__,
": failed to delete \"Arrow Down\" sign! Error code = ",GetLastError());
return(false);
}
//--- successful executionreturn(true);
}
//+------------------------------------------------------------------+
C'est cool. Nous devons seulement écrire lafonction OnDeinit(). Dans la fonction OnDeinit() se tiendra le programme de nettoyage. Devoir : écrire du code pour supprimer des objets par préfixe.
//+------------------------------------------------------------------+//| TEST3.mq4 |//| Copyright 2015, MetaQuotes Software Corp. |//| https://www.mql5.com |//+------------------------------------------------------------------+#property copyright"Copyright 2015, MetaQuotes Software Corp."#property link"https://www.mql5.com"#property version"1.00"#property strict#property indicator_chart_window//--- input parametersinputbool Alerts=TRUE;
//--- input parameters of the script inputstring InpNameUP="ArrowUp"; // Sign name UPinputstring InpNameDOWN="ArrowDown"; // Sign name DOWNinputENUM_ARROW_ANCHOR InpAnchorUP=ANCHOR_TOP; // Anchor type inputENUM_ARROW_ANCHOR InpAnchorDOWN=ANCHOR_BOTTOM; // Anchor type inputcolor InpColorUP=clrGreen; // Sign color UPinputcolor InpColorDOWN=clrRed; // Sign color DOWNinputENUM_LINE_STYLE InpStyle=STYLE_DOT; // Border line style inputint InpWidth=5; // Sign size inputbool InpBack=false; // Background sign inputbool InpSelection=false; // Highlight to move inputbool InpHidden=true; // Hidden in the object list inputlong InpZOrder=0; // Priority for mouse click //+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit(void)
{
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Indicator |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime &time[],
constdouble &open[],
constdouble &high[],
constdouble &low[],
constdouble &close[],
constlong &tick_volume[],
constlong &volume[],
constint &spread[])
{
staticdatetime prev;
if(time[0]>prev) // new bar
{
//----if(Alerts)
{
if(close[4]>open[4] && close[3]>open[3] && close[2]>open[2] && close[1]<open[2])
{
string SELLSIGNAL=InpNameDOWN+(string)time[1];
ArrowDownCreate(0,SELLSIGNAL,0,time[1],high[1],InpAnchorDOWN,InpColorDOWN,InpStyle,
InpWidth,InpBack,InpSelection,InpHidden);
}
elseif(close[4]<open[4] && close[3]<open[3] && close[2]<open[2] && close[1]>open[2])
{
string BUYSIGNAL=InpNameUP+(string)time[1];
ArrowUpCreate(0,BUYSIGNAL,0,time[1],low[1],InpAnchorUP,InpColorUP,InpStyle,
InpWidth,InpBack,InpSelection,InpHidden);
}
}
}
prev=time[0];
//----return(rates_total);
}
//+------------------------------------------------------------------+ //| Create Array Up sign | //+------------------------------------------------------------------+ bool ArrowUpCreate(constlong chart_ID=0, // chart's ID conststring name="ArrowUp", // sign name constint sub_window=0, // subwindow index datetime time=0, // anchor point time double price=0, // anchor point price constENUM_ARROW_ANCHOR anchor=ANCHOR_BOTTOM, // anchor type constcolor clr=clrRed, // sign color constENUM_LINE_STYLE style=STYLE_SOLID, // border line style constint width=3, // sign size constbool back=false, // in the background constbool selection=true, // highlight to move constbool hidden=true, // hidden in the object list constlong z_order=0) // priority for mouse click
{
//--- reset the error value ResetLastError();
//--- create the sign if(!ObjectCreate(chart_ID,name,OBJ_ARROW_UP,sub_window,time,price))
{
Print(__FUNCTION__,
": failed to create \"Arrow Up\" sign! Error code = ",GetLastError());
return(false);
}
//--- set anchor type ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor);
//--- set a sign color ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- set the border line style ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
//--- set the sign size ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width);
//--- display in the foreground (false) or background (true) ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- enable (true) or disable (false) the mode of moving the sign by mouse //--- when creating a graphical object using ObjectCreate function, the object cannot be //--- highlighted and moved by default. Inside this method, selection parameter //--- is true by default making it possible to highlight and move the object ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- hide (true) or display (false) graphical object name in the object list ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the priority for receiving the event of a mouse click in the chart ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful execution return(true);
}
//+------------------------------------------------------------------+ //| Create Array Down sign | //+------------------------------------------------------------------+ bool ArrowDownCreate(constlong chart_ID=0, // chart's ID conststring name="ArrowDown", // sign name constint sub_window=0, // subwindow index datetime time=0, // anchor point time double price=0, // anchor point price constENUM_ARROW_ANCHOR anchor=ANCHOR_BOTTOM, // anchor type constcolor clr=clrRed, // sign color constENUM_LINE_STYLE style=STYLE_SOLID, // border line style constint width=3, // sign size constbool back=false, // in the background constbool selection=true, // highlight to move constbool hidden=true, // hidden in the object list constlong z_order=0) // priority for mouse click
{
//--- reset the error value ResetLastError();
//--- create the sign if(!ObjectCreate(chart_ID,name,OBJ_ARROW_DOWN,sub_window,time,price))
{
Print(__FUNCTION__,
": failed to create \"Arrow Down\" sign! Error code = ",GetLastError());
return(false);
}
//--- anchor type ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor);
//--- set a sign color ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- set the border line style ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
//--- set the sign size ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width);
//--- display in the foreground (false) or background (true) ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- enable (true) or disable (false) the mode of moving the sign by mouse //--- when creating a graphical object using ObjectCreate function, the object cannot be //--- highlighted and moved by default. Inside this method, selection parameter //--- is true by default making it possible to highlight and move the object ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- hide (true) or display (false) graphical object name in the object list ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the priority for receiving the event of a mouse click in the chart ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful execution return(true);
}
//+------------------------------------------------------------------+//| Delete All Arrows |//+------------------------------------------------------------------+bool ArrowDeleteAll(constlong chart_ID=0,// chart's IDconstENUM_OBJECT type=OBJ_ARROW_DOWN) // type of objects
{
//--- reset the error valueResetLastError();
//--- delete the signif(!ObjectsDeleteAll(chart_ID,-1,type))
{
Print(__FUNCTION__,
": failed to delete all ",EnumToString(type),"! Error code = ",GetLastError());
return(false);
}
//--- successful executionreturn(true);
}
//--------------------------------------------------------------------//Function: DeleteObjectsByPrefix//Purpose: Deletes objects with prefix of passed string//Inputs: Prefix (string)//Returns: (void)//--------------------------------------------------------------------void ObjectsDeletePrefixed(string sPrefix) {
for(int i=ObjectsTotal()-1; i>=0; i--) {
if(StringFind(ObjectName(i),sPrefix)==0) ObjectDelete(ObjectName(i));
}
}
//+------------------------------------------------------------------+//| Custom indicator deinitialization function |//+------------------------------------------------------------------+voidOnDeinit(constint reason)
{
ArrowDeleteAll(0,OBJ_ARROW_DOWN);
ArrowDeleteAll(0,OBJ_ARROW_UP);
}
//+------------------------------------------------------------------+
Monsieur, le code du préfixe est là mais il ne fonctionne pas encore.
//+------------------------------------------------------------------+//| Test.mq4 |//| Copyright 2015, MetaQuotes Software Corp. |//| https://www.mql5.com |//+------------------------------------------------------------------+#property copyright"Copyright 2015, MetaQuotes Software Corp."#property link"https://www.mql5.com"#property version"1.00"#property strict#property indicator_chart_window//--- input parametersinputbool Alerts=TRUE;
//--- input parameters of the script inputstring InpNameUP="ArrowUp"; // Sign name UPinputstring InpNameDOWN="ArrowDown"; // Sign name DOWNinputENUM_ARROW_ANCHOR InpAnchorUP=ANCHOR_TOP; // Anchor type inputENUM_ARROW_ANCHOR InpAnchorDOWN=ANCHOR_BOTTOM; // Anchor type inputcolor InpColorUP=clrGreen; // Sign color UPinputcolor InpColorDOWN=clrRed; // Sign color DOWNinputENUM_LINE_STYLE InpStyle=STYLE_DOT; // Border line style inputint InpWidth=5; // Sign size inputbool InpBack=false; // Background sign inputbool InpSelection=false; // Highlight to move inputbool InpHidden=true; // Hidden in the object list inputlong InpZOrder=0; // Priority for mouse click //+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit(void)
{
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Indicator |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime &time[],
constdouble &open[],
constdouble &high[],
constdouble &low[],
constdouble &close[],
constlong &tick_volume[],
constlong &volume[],
constint &spread[])
{
staticdatetime prev;
if(time[0]>prev) // new bar
{
//----if(Alerts)
{
if(close[4]>open[4] && close[3]>open[3] && close[2]>open[2] && close[1]<open[2])
{
string SELLSIGNAL=InpNameDOWN+(string)time[1];
ArrowDownCreate(0,SELLSIGNAL,0,time[1],high[1],InpAnchorDOWN,InpColorDOWN,InpStyle,
InpWidth,InpBack,InpSelection,InpHidden);
}
else
{ ObjectsDeleteAll(0,OBJ_ARROW_DOWN);
}
if(close[4]<open[4] && close[3]<open[3] && close[2]<open[2] && close[1]>open[2])
{
string BUYSIGNAL=InpNameUP+(string)time[1];
ArrowUpCreate(0,BUYSIGNAL,0,time[1],low[1],InpAnchorUP,InpColorUP,InpStyle,
InpWidth,InpBack,InpSelection,InpHidden);
}
else
{ ObjectsDeleteAll(0,OBJ_ARROW_UP);
}
}
}
prev=time[0];
//----return(rates_total);
}
//+------------------------------------------------------------------+ //| Create Array Up sign | //+------------------------------------------------------------------+ bool ArrowUpCreate(constlong chart_ID=0, // chart's ID conststring name="ArrowUp", // sign name constint sub_window=0, // subwindow index datetime time=0, // anchor point time double price=0, // anchor point price constENUM_ARROW_ANCHOR anchor=ANCHOR_BOTTOM, // anchor type constcolor clr=clrRed, // sign color constENUM_LINE_STYLE style=STYLE_SOLID, // border line style constint width=3, // sign size constbool back=false, // in the background constbool selection=true, // highlight to move constbool hidden=true, // hidden in the object list constlong z_order=0) // priority for mouse click
{
//--- reset the error value ResetLastError();
//--- create the sign if(!ObjectCreate(chart_ID,name,OBJ_ARROW_UP,sub_window,time,price))
{
Print(__FUNCTION__,
": failed to create \"Arrow Up\" sign! Error code = ",GetLastError());
return(false);
}
//--- set anchor type ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor);
//--- set a sign color ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- set the border line style ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
//--- set the sign size ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width);
//--- display in the foreground (false) or background (true) ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- enable (true) or disable (false) the mode of moving the sign by mouse //--- when creating a graphical object using ObjectCreate function, the object cannot be //--- highlighted and moved by default. Inside this method, selection parameter //--- is true by default making it possible to highlight and move the object ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- hide (true) or display (false) graphical object name in the object list ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the priority for receiving the event of a mouse click in the chart ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful execution return(true);
}
//+------------------------------------------------------------------+ //| Create Array Down sign | //+------------------------------------------------------------------+ bool ArrowDownCreate(constlong chart_ID=0, // chart's ID conststring name="ArrowDown", // sign name constint sub_window=0, // subwindow index datetime time=0, // anchor point time double price=0, // anchor point price constENUM_ARROW_ANCHOR anchor=ANCHOR_BOTTOM, // anchor type constcolor clr=clrRed, // sign color constENUM_LINE_STYLE style=STYLE_SOLID, // border line style constint width=3, // sign size constbool back=false, // in the background constbool selection=true, // highlight to move constbool hidden=true, // hidden in the object list constlong z_order=0) // priority for mouse click
{
//--- reset the error value ResetLastError();
//--- create the sign if(!ObjectCreate(chart_ID,name,OBJ_ARROW_DOWN,sub_window,time,price))
{
Print(__FUNCTION__,
": failed to create \"Arrow Down\" sign! Error code = ",GetLastError());
return(false);
}
//--- anchor type ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor);
//--- set a sign color ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- set the border line style ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
//--- set the sign size ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width);
//--- display in the foreground (false) or background (true) ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- enable (true) or disable (false) the mode of moving the sign by mouse //--- when creating a graphical object using ObjectCreate function, the object cannot be //--- highlighted and moved by default. Inside this method, selection parameter //--- is true by default making it possible to highlight and move the object ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- hide (true) or display (false) graphical object name in the object list ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the priority for receiving the event of a mouse click in the chart ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful execution return(true);
}
//+------------------------------------------------------------------+//| Delete All Arrows |//+------------------------------------------------------------------+bool ArrowDeleteAll(constlong chart_ID=0,// chart's IDconstENUM_OBJECT type=OBJ_ARROW_DOWN) // type of objects
{
//--- reset the error valueResetLastError();
//--- delete the signif(!ObjectsDeleteAll(chart_ID,-1,type))
{
Print(__FUNCTION__,
": failed to delete all ",EnumToString(type),"! Error code = ",GetLastError());
return(false);
}
//--- successful executionreturn(true);
}
//+------------------------------------------------------------------+//| Custom indicator deinitialization function |//+------------------------------------------------------------------+voidOnDeinit(constint reason)
{
ArrowDeleteAll(0,OBJ_ARROW_DOWN);
ArrowDeleteAll(0,OBJ_ARROW_UP);
}
intObjectsDeleteAll(
long chart_id, // chart IDconststring prefix, // prefix in object nameint sub_window=-1, // window indexint object_type=-1// object type
);
//+------------------------------------------------------------------+
Migrer vers les nouvelles technologies : utiliser les projets dans MQL5 Storage(Projects - MetaEditor). J'ai créé un projet pour vous :
Fait monsieur, mais n'est pas encore fonctionnel.
Monsieur Karputov Vladimir, veuillez répondre à mon message.
Aide :ObjectsDeleteAll.
Vérifiez le dossier "Projects" dans MetaEditor.
P.S. Pour l'optimisation il est nécessaire de limiter le nombre de barres pour dessiner les flèches.
Mais ce ne sera pas le cas aujourd'hui.
Joindre le fichier de la version "1.04".
Forum sur le trading, les systèmes de trading automatisés et les tests de stratégies de trading
s'il vous plaît aidez-moi à mettre une flèche d'achat et de vente sur ce code.
Karputov Vladimir, 2015.11.09 13:36
Vérifiez le dossier "Projets" dans MetaEditor.
P.S. Pour l'optimisation il est nécessaire de limiter le nombre de barres pour dessiner les flèches.
Mais ce ne sera pas le cas aujourd'hui.
Joindre le fichier de la version "1.04".