How to delete objects created by script? (arrows and lines on the chart)

To add comments, please log in or register
Rômulo Valente
117
Rômulo Valente  

I've been using two scripts (one for placing buy orders and an equivalent one to sell orders), and every time this script places an order, it plots an arrow and those little lines above indicating the TP and SL levels.

Is there a way to prevent these from being plotted? As I need to open and cancel my orders many times (before it gets filled), these arrows pile up and makes the chart look very poluted.


I know that i can delete all these objects manually, but I want to prevent them from popping every time on the chart.

This is the code to the buy script:

#property show_inputs

extern double Lots = 0.1;
extern bool   UseMoneyMgmt = true;
extern double RiskPercent = 14.3;
extern bool   UseStop = true;
extern bool   UseTakeProfit = true;
extern double StopLoss = 100;
extern double TakeProfit = 120;
extern string Note="0 in Entry field means Market Order Buy";
extern double Entry = 1.0000;

string Input = " Buy Price ";



//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  { 
  double Risk = RiskPercent / 100;
  if (UseMoneyMgmt)  
   Lots = NormalizeDouble( AccountBalance()*Risk/StopLoss/(MarketInfo(Symbol(), MODE_TICKVALUE)),2); 
  int Mode = OP_BUYSTOP;
  if (Ask > Entry && Entry > 0) Mode = OP_BUYLIMIT; 
  if (Entry == 0)  {Entry = Ask; Mode = OP_BUY;}
  double SLB = Entry - StopLoss*Point, TPB = Entry + TakeProfit*Point;
  if (UseStop == false) SLB = 0;
  if (UseTakeProfit == false) TPB = 0;
  if(Lots > 0)
   OrderSend(Symbol(),Mode, Lots, Entry, 2,SLB , TPB, "Buy Script", 0, NULL, LimeGreen);


           
   return(0);
  }

Can you guys help me?

Thanks

Beerrun
62
Beerrun  
Remove the arrow colour section from your ordersend
boobyditbeber
120
boobyditbeber  
Rômulo Valente:

I've been using two scripts (one for placing buy orders and an equivalent one to sell orders), and every time this script places an order, it plots an arrow and those little lines above indicating the TP and SL levels.

Is there a way to prevent these from being plotted? As I need to open and cancel my orders many times (before it gets filled), these arrows pile up and makes the chart look very poluted.


I know that i can delete all these objects manually, but I want to prevent them from popping every time on the chart.

This is the code to the buy script:

Can you guys help me?

Thanks

Hi

Idea, make an indicator that could check all object in the chart and delete whose who are not welcome. the best and discret that do the job automayically.

check well all the command in the doc mql4 to find the right function that will work for that.

Bye


Laurent

Rômulo Valente
117
Rômulo Valente  
Beerrun:
Remove the arrow colour section from your ordersend

Thanks a lot! Worked perfectly, I just erased the last variable of Ordersend.

To add comments, please log in or register