Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 584

 
Question: How can I run the optimizer in the strategy tester to discard options when a StopLoss appears (in the same way as a negative option is discarded)?
 
Help me solve the problem with deleting graphical objects. There are graphical objects with code 251 and ObjectsDeleteAll (0,OBJ_ARROW); is it possible to make objects with code 251 be deleted only?
 
Alexandr24:
Help me solve the problem with deleting graphical objects. I have graphical objects with code 251 and have ObjectsDeleteAll (0,OBJ_ARROW); can I somehow make objects with code 251 only be deleted?

You can try it this way: when forming an object with code 251, give it a name like "Setka"+DoubleToStr(Sprice,Digits); or "Setka"+Time[r]; and when you want to delete all these objects, do the following

for(int i=ObjectsTotal()-1; i>=0 ; i--)
{if(StringFind(ObjectName(i), "Setka") >= 0) ObjectDelete(ObjectName(i)) ;}
All objects containing Setka in the name will be deleted .

 
kon12:

You can try it this way: when forming an object with code 251, give it a name like "Setka"+DoubleToStr(Sprice,Digits); or "Setka"+Time[r]; and when you want to delete all these objects, do the following

for(int i=ObjectsTotal()-1; i>=0 ; i--)
{if(StringFind(ObjectName(i), "Setka") >= 0) ObjectDelete(ObjectName(i)) ;}
All objects containing Setka in the name will be deleted .


I'll have to give it a try. Thank you.
 

Hello, could you please tell me if there is a function for an indicator that can change the colour of bars when conditions are met. for MT4

I want to make a trend indicator which will change the colour of bars when the trend changes

 

Hello, everyone. Straight to the point.

Here's the array :

x_tick[5]={0}; 

I want it to be like this:

extern int size=5;
x_tick[size]={0}; 

It's saying it's wrong. I know it's the right way to write it in C:

const int size=5;

but it doesn't work here.

Please advise what can be done to enable an Expert Advisor to search the size of an array by extern, in the tester.

Thanks

 

Please advise why the arrows are deleted in this variant

int deinit()

{

//----

ObjectsDeleteAll(0,OBJ_ARROW);

}

...

...

{
ObjectCreate(arrowName,OBJ_ARROW,0,;)
ObjectSet(arrowName,OBJPROP_ARROWCODE,251);
ObjectSet(arrowName,OBJPROP_COLOR,Red);
}

but not in this one ?

int deinit()
{
//----

ObjectsDeleteAll(0,OBJ_ARROW_STOP);

}

...

...

{
ObjectCreate(arrowName,OBJ_ARROW_STOP,0,...);
ObjectSet(arrowName,OBJPROP_COLOR,Red);
}
 

Friends. How do I place graphical objects on a chart that is not current? If multicurrency works on EURUSD, but it needs to draw something on AUDUSD chart (assuming it's open).

I can't seem to understand the new functions. I am getting old...

 
artmedia70:

Dudes. How do I place graphical objects on a non current chart? If multicurrency works on EURUSD, but it needs to draw something on AUDUSD chart (if it's open).

I can't seem to make sense of the new functions. Getting old...



I can do this, except for drawing orders from the main window....

  t2=iTime(_Symbols[j],PERIOD_M1,0);
            if(BID_L_1!=0 && BID_L_2!=0 && BID_13!=0)
               {
               //--- переменные для идентификаторов графиков
                  long currChart,prevChart=ChartFirst();
                  i=0;int limit=100;                  while(i<limit)// у нас наверняка не больше 100 открытых графиков
                     {
                        currChart=ChartNext(prevChart); // на основании предыдущего получим новый график
                        if(ChartSymbol(currChart)==_Symbols[j])
                           {
                              ObjectCreate(currChart,"INFO_100",OBJ_LABEL,0,0,0);
                              ObjectSetInteger(currChart,"INFO_100",OBJPROP_COLOR,clrBlack);
                              ObjectSetInteger(currChart,"INFO_100",OBJPROP_FONTSIZE,30);
                              ObjectSetInteger(currChart,"INFO_100",OBJPROP_XDISTANCE,770);
                              ObjectSetInteger(currChart,"INFO_100",OBJPROP_YDISTANCE,300);                                                                                          
                              ObjectSetString(currChart,"INFO_100",OBJPROP_TEXT,_Symbols[j]);                              
			      ObjectSet("INFO_100",OBJPROP_XDISTANCE,0);// изменяем координату х   
                              ObjectSet("INFO_100",OBJPROP_YDISTANCE,300);// изменяем координату у                              ObjectCreate(currChart,"INFO_101"+TimeToStr(TimeCurrent(),TIME_DATE), OBJ_TREND, 0, t1, BID_13, t2, BID_13);
                              ObjectSetInteger(currChart,"INFO_101"+TimeToStr(TimeCurrent(),TIME_DATE),OBJPROP_COLOR,clrGreen);
                              ObjectSetInteger(currChart,"INFO_101"+TimeToStr(TimeCurrent(),TIME_DATE),OBJPROP_WIDTH,5);
                              ObjectSetInteger(currChart,"INFO_101"+TimeToStr(TimeCurrent(),TIME_DATE),OBJPROP_RAY,false);
                              
                              ObjectCreate(currChart,"INFO_102"+TimeToStr(TimeCurrent(),TIME_DATE), OBJ_TREND, 0, t1, BID_L_1, t2, BID_L_1);
                              ObjectSetInteger(currChart,"INFO_102"+TimeToStr(TimeCurrent(),TIME_DATE),OBJPROP_COLOR,clrRed);
                              ObjectSetInteger(currChart,"INFO_102"+TimeToStr(TimeCurrent(),TIME_DATE),OBJPROP_WIDTH,5);
                              ObjectSetInteger(currChart,"INFO_102"+TimeToStr(TimeCurrent(),TIME_DATE),OBJPROP_RAY,false);

                              ObjectCreate(currChart,"INFO_103"+TimeToStr(TimeCurrent(),TIME_DATE), OBJ_TREND, 0, t1, BID_L_2, t2, BID_L_2);
                              ObjectSetInteger(currChart,"INFO_103"+TimeToStr(TimeCurrent(),TIME_DATE),OBJPROP_COLOR,clrBlue);
                              ObjectSetInteger(currChart,"INFO_103"+TimeToStr(TimeCurrent(),TIME_DATE),OBJPROP_WIDTH,5);
                              ObjectSetInteger(currChart,"INFO_103"+TimeToStr(TimeCurrent(),TIME_DATE),OBJPROP_RAY,false);
                              ChartRedraw(currChart);
                           }
                        if(currChart<0) break;          // достигли конца списка графиков
                        prevChart=currChart;// запомним идентификатор текущего графика для ChartNext()
                        i++;// не забудем увеличить счетчик
                     } 
 
artmedia70:

Druggies. How do I place graphical objects on a non current chart? If multicurrency works on EURUSD, but it needs to draw something on AUDUSD chart (if it's open).

I can't seem to make sense of the new functions. Getting old...


If it helped, please help me draw orders from the main window.... please
Reason: