On-chart independent close button for every open position - page 3

 

I understand why you wouldn't want the terminal open.

I always have it open with the Experts tab.

I don't actually trade that much and only in the higher time-frames so I rarely need to check the chart.

Funnily enough, when I am trading I don't use any EAs or Indicators.

 
Keith Watford:

I understand why you wouldn't want the terminal open.

I always have it open with the Experts tab.

I don't actually trade that much and only in the higher time-frames so I rarely need to check the chart.

Funnily enough, when I am trading I don't use any EAs or Indicators.

I agree with you. Higher timeframes are the best. Less screen time, more accurate signals and Less spread given to the broker.

Cheers

 
Alireza Boroumand #:
Your suggestions helped me a lot. Sure, I'll follow your instructions.
Hey Alireza, I know this is an old post but how would you go about deleting the button. I tried creating a loop in the DeInt where I loop through all the orders and delete the objects that matches the open orders which kind of work but if I decide to close the normal way I have no way of checking to see if the ticket matches the button 
 
Johansson K Thompson #:
Hey Alireza, I know this is an old post but how would you go about deleting the button. I tried creating a loop in the DeInt where I loop through all the orders and delete the objects that matches the open orders which kind of work but if I decide to close the normal way I have no way of checking to see if the ticket matches the button 

I understand that this is old thread, but I have the same concern like you. And after a little time to digging and trying, I can solve it now.

All we need is going to loop through the button, and delete it OnDeInit() Event of the EA/ Script.

void DeInit()
  {
// Delete all related buttons
   for(int i=ObjectsTotal(0)-1; i >= 0; --i) // Loop through all object
     {
      string  sparam = ObjectName(0,i); // Get param of that object

      if(ObjectGetInteger(0, sparam, OBJPROP_TYPE) == OBJ_BUTTON) // Check for type is Button
        {
         int pos = StringFind(sparam, "DongTatCa");  // This's my special name for my button
         if(pos>=0)
           {ButtonDelete(0,sparam);} // I make a delete function here

         pos = StringFind(sparam, "BtnClose");  // Do it again for another button
         if(pos>=0)
           {
            ButtonDelete(0,sparam);
           }

         pos = StringFind(sparam, "MoveBEButton");
         if(pos>=0)
           {
            ButtonDelete(0,sparam);
           }

         pos = StringFind(sparam, "CloseHalfButton");
         if(pos>=0)
           {
            ButtonDelete(0,sparam);
           }
        }
     }
  }