| // Snippet 1: create the custom symbol and copy the source symbol's trading settings (TF_Engine.mqh)
|
| bool CTFEngine::SetupSymbol(CTFResult &res)
|
| {
|
| bool custom;
|
| bool exists = TF_SymbolExists(m_job.name, custom);
|
| if(exists && !custom) { res.err = "'" + m_job.name + "' is a real broker symbol - choose another name"; return false; }
|
| if(exists)
|
| {
|
| CustomRatesDelete(m_job.name, 0, LONG_MAX);
|
| CustomTicksDelete(m_job.name, 0, LONG_MAX);
|
| }
|
| else if(!CustomSymbolCreate(m_job.name, "Tick Forge", m_job.src))
|
| { res.err = StringFormat("CustomSymbolCreate failed (err %d)", GetLastError()); return false; }
|
| SymbolSelect(m_job.name, true);
|
|
|
| // trading permissions follow the source, so an Expert's orders are accepted exactly as on the real symbol
|
| const ENUM_SYMBOL_INFO_INTEGER props[] = {SYMBOL_FILLING_MODE, SYMBOL_ORDER_MODE, SYMBOL_EXPIRATION_MODE, SYMBOL_TRADE_EXEMODE, SYMBOL_TRADE_MODE};
|
| for(int k = 0; k < ArraySize(props); k++)
|
| CustomSymbolSetInteger(m_job.name, props[k], SymbolInfoInteger(m_job.src, props[k]));
|
|
|
| // sample the price factor across the range to size the digits
|
| }
|