Synthetic Symbol creation and formula edit with EA

 

Hi, 

Does the MQL5 support the option to create a synthetic symbol -> add to watchlist -> edit the formula so it has quotes. 

I've managed to create the syntgetic symbol and add it to the watchlist but can not find a way to add a formula with the EA (when I do it manually it work like a charm). 

Does anyone know how I can do this with the EA?

Thanks! 

 
dedormazzz:

Hi, 

Does the MQL5 support the option to create a synthetic symbol -> add to watchlist -> edit the formula so it has quotes. 

I've managed to create the syntgetic symbol and add it to the watchlist but can not find a way to add a formula with the EA (when I do it manually it work like a charm). 

Does anyone know how I can do this with the EA?

Thanks! 

Hello 

Yes you can : 

Try this little test 

#property copyright "discussion"
#property link      "https://www.mql5.com/en/forum/451537"
#property version   "1.00"
input string customName="MySymblo";//Custom symbol name
input string customFormula="EURUSD+GBPUSD";//the formula
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
  EventSetMillisecondTimer(44); 
//---
   return(INIT_SUCCEEDED);
  }
void OnTimer(){
EventKillTimer();
if(CustomSymbolCreate(customName,"Synth",NULL)){
  CustomSymbolSetString(customName,SYMBOL_FORMULA,customFormula);
  Print("Yay");
  }else{
  Print("Cannot create");
  }
  ExpertRemove();
  Print("DONE");
}
void OnDeinit(const int reason)
  {
  }

void OnTick()
  {
  }

 
Lorentzos Roussos #:



Hi mate, thanks!