IndicatorRe: Indicators with ON/OFF buttons

1843
Hi Guys,
Could someone add an ON/OFF button on this gap finder indicator I've recently modified?
I'm an amateur noobie programmer and I can only code basic things and this is getting pretty challenging for me.
I've tried to integrate and modify part of other codes with buttons template but no way.

This are the indicators inputs which are customizable
Image


This is how it prints gaps on charts

Image

Code: Select all

#property indicator_chart_window
#property indicator_buffers 1
#property description "Automatically render boxes for liquidity gaps "
#property indicator_color1 Black

extern double Gap_Size_Minimum = 100;
extern int ExtendBars = 1000;
extern int    History = 1000;
extern color Gap_Up = Aqua;
extern color Gap_Down = Tomato;
input ENUM_LINE_STYLE Rectangle_Style = STYLE_SOLID;

double Pip;
int init()
  {
    Pip = Point;
   if(Digits==3 || Digits==5) Pip = 10*Point;
   return(0);
  }

int deinit()
  {
    string ObjName;
    for(int i = ObjectsTotal()-1; i>=0; i--)
    {
      ObjName = ObjectName(i);
      if(StringFind(ObjName,"liquidity_gaps",0)>=0)
        ObjectDelete(ObjName);
    }
    return(0);
  }

int start()
  {
   int i, limit, counted_bars=IndicatorCounted();
   limit = MathMin(History,Bars-counted_bars-1);
   string ObjName;
   for(i=limit; i>=0; i--)
   {
     if(i>Bars-2) continue;
     if(MathAbs(Open[i]-Close[i+1]) > Gap_Size_Minimum*Pip)
     {
       ObjName = "liquidity_gaps_Up_"+Time[i];
       color ObjColor;
       if(Open[i] > Close[i+1]) ObjColor = Gap_Up;
       else ObjColor = Gap_Down;
       if(ObjectFind(ObjName)<0)
       {  
         ObjectCreate(ObjName,OBJ_RECTANGLE,0,Time[i+1],Close[i+1],Time[i],Open[i]);
         ObjectSet(ObjName,OBJPROP_BACK,0);         
         ObjectSet(ObjName,OBJPROP_COLOR,ObjColor);                 
         ObjectSet(ObjName,OBJPROP_STYLE,Rectangle_Style);
       }
     }
     
     //datetime thistime = Time[i];     
     int ib = i+ExtendBars;
     while(ib>=0)
     
     {
       ObjName = "liquidity_gaps_Up_"+Time[ib];
       if(ObjectFind(ObjName)>=0)
       {
         double pr2 = ObjectGet(ObjName,OBJPROP_PRICE2);
         double pr1 = ObjectGet(ObjName,OBJPROP_PRICE2);
         ObjectSet(ObjName,OBJPROP_TIME2,Time[i]);
         ObjectSet(ObjName,OBJPROP_PRICE2,pr2);
       }
       ib--;
     }
   }
   return(0);
  }
Thanks in advance for you kind help

Re: Indicators with ON/OFF buttons

1845
PumbaPLS wrote: Sun Mar 13, 2022 9:20 pm Could a button be added to this currency strength indicator?
Hello, sorry for the delay, havent much time...here is...
These users thanked the author kvak for the post (total 3):
太虚一毫, toddanderson, Thangarasu


Re: Indicators with ON/OFF buttons

1846
Mescalito wrote: Sun Mar 13, 2022 11:03 pm Could a button be added to this indicator, as well as arrows, and alarms please? I believe it can be very useful for finding zones of pullback and entries, it combines the signals of two different timeframes, in the picture I have it with 30min as the first timeframe and 240min as the second.

i-3CCI-h.mq4
Hello, try it...
These users thanked the author kvak for the post:
太虚一毫

Re: Indicators with ON/OFF buttons

1847
quangvuig wrote: Mon Mar 14, 2022 12:42 am Hello. Hope you can help me add a button to the T indicator.
There are many of these indicators that have added the MACD BB button but the parameters I cannot adjust to fit the chart. Hope you add nut to this indicator
try this...
These users thanked the author kvak for the post (total 2):
太虚一毫, Woodyz

Re: Indicators with ON/OFF buttons

1849
FT_Trading wrote: Mon Mar 14, 2022 11:44 pm Hi Guys,
Could someone add an ON/OFF button on this gap finder indicator I've recently modified?
I'm an amateur noobie programmer and I can only code basic things and this is getting pretty challenging for me.
I've tried to integrate and modify part of other codes with buttons template but no way.

This are the indicators inputs which are customizable
Image


This is how it prints gaps on charts

Hello, for this, havent solution, sorry. Trying different template and its not working without bug. Problems isnt delete lines but call it back to window....
These users thanked the author kvak for the post:
FT_Trading


Who is online

Users browsing this forum: ChatGPT [Bot], IBM oBot [Bot], Telegram [Bot], thomdel, Woodyz and 102 guests