Download MetaTrader 5

update watch list programatically

To add comments, please log in or register
rob
100
rob  

A timer within a EA that loads all watch symbols weeds out the ones I dont want:

meetsCriterion

Sorts the List and displays the data

   list.Sort(sortVar);
   posY++;
   list.displayData(var,posY,sortVar);

the timer void:

void OnTimer()
  {
   EventSetTimer(deltaTime);
   Print("EA CSI DATA1 deltaTime "+string(deltaTime));
//set and count the symbols data
   TotalSymbols=FindSymbols();
   ArrayResize(Symbols,TotalSymbols);
   ArrayResize(Descr,TotalSymbols);
   string var="variable";
//Clean up variables
   deleteVariables();
//set Headers 
   int posY=0;
   displayHeaders(var,posY,acceptableMargin,tf);
//clean up old display
   instrumentList list;
   list.Clear();
//Fill Market Watch - have to or does not have any values
   for(int j=0; j<TotalSymbols; j++)//all Instruments
     {
      if(!IsSymbolInMarketWatch(Symbols[j]))
         SymbolSelect(Symbols[j],true);
     }

//delete instruments that dont match criterion
   for(int j=0; j<TotalSymbols; j++)//all Instruments
     {
      bool isInWatch=IsSymbolInMarketWatch(Symbols[j]);
      if(isInWatch)
         if(!meetsCriterion(Symbols[j],acceptableMargin))
            SymbolSelect(Symbols[j],false);
      else
         list.Add(new instrument(Symbols[j],Descr[j],tf,indPeriod,adxAgo,maxBars,equityRisk,acceptableMargin));
     }

   list.Sort(sortVar);
   posY++;
   list.displayData(var,posY,sortVar);
//Fill Market Watch - have to or does not have any values
//Why Don't know
   for(int j=0; j<TotalSymbols; j++)//all Instruments
     {
      if(!IsSymbolInMarketWatch(Symbols[j]))
         SymbolSelect(Symbols[j],true);
     }
//Delete Trash and keep highest probability movers
   list.FillWatchPreferred(watchFill,TotalSymbols);
  }


Output


All good short output with a few symbols shown!

Effect: Now I want to re populate the watch List : The symbol can be hidden from MarketWatch after 10 minutes .... 

SymbolSelect(Symbols[i],false);

From documentation: the terminal stores symbol data for 10 minutes since the last access to them

Question: Anyone know is there anyway to clear specific terminal variables or another way to achieve the desired Effect? 

If not I will try to use two templates with two EA's one loading and sorting data and writing to file...the other one displaying it ... hoping this may provide a solution since the watch can be cleared after ea Init it seems

At the moment I am struggling with my linux path but thats another topic.

I guess if I run two EAs one to write periodically the symbols I want to study and one to read file if changed (touched), to display the information I want...might work?

To add comments, please log in or register