Need Help on Tweaking the Indicator!!!

AndreiCroitor

Active Trader
Mar 26, 2019
9
0
32
Hello Everyone!
Its been a while i am still learning mql coding and asking for help for a tweak to change the background color when the buffer is being triggered. well i found 2 method of doing this but both have disadvantages.
1st was
MQL4:
 ObjectCreate( "back", OBJ_LABEL, 0, 0, 0 );
 ObjectCreate(0,name,OBJ_RECTANGLE_LABEL,0,Time[0],Close[0]);
.
2nd was
MQL4:
ChartSetInteger(0,CHART_COLOR_BACKGROUND,clrDarkBlue);
Then i chose the 2nd line of code that can do it but the problem is background don't return back to default color after the buffers being not triggered again.., It wud be helpfull if anyone know how to do that!? thanks in advance! :)

Below here i upoaded the mq4 file also examples of the chart color background changes when buffers are being triggered but they dont change back to default till next sell/buy buffer being triggered. wish it will be normal background when there is no arrow :)))
 

Attachments

Last edited:

AndreiCroitor

Active Trader
Mar 26, 2019
9
0
32
Good evening Enivid! thanks for reply i was waiting!:) But the thing is i coudnt figure that out this time. and here the part i did but still it doesnt return back to default color background after that expiry or that after buffers not being hitten.
MQL4:
//----////////////////////////////////////////////
    static datetime dtlboai11;
    double price = (Bid+Ask)/2;
 
   if(dtlboai11!=iTime(Symbol(),0,0) )
   {
      if(BuyBuffer[gAlertShift]!=EMPTY_VALUE )
      {
         if (AlertSound)
               PlaySound("alert.wav");
          ChartSetInteger(0,CHART_COLOR_BACKGROUND,clrDarkBlue);  
 
         dtlboai11=iTime(Symbol(),0,0);
      }
      //----
      else if(SellBuffer[gAlertShift]!=EMPTY_VALUE )
      {
 
        if (AlertSound)
               PlaySound("alert2.wav");
         ChartSetInteger(0,CHART_COLOR_BACKGROUND,clrMaroon);  
 
         dtlboai11=iTime(Symbol(),0,0);
      }
   }
 
//----////////////////////////////////////////////
current condition changes color background but it remains in that color till next sell/buy buffer hit. so i am trying it changes just after that candle close if the there is no arrow back to normal background color. even we chose 3 color how to do that? please teach!!!? thank you for your time , i appreciate that! :)