Libraries: Symbol - page 11

 

The challenge

CLONE(SYMBOL_FORMULA)

is questionable. Usually custom symbols in MQL5 calculate bars and ticks by themselves, and transferring the formula makes it impossible to manage a new symbol. The idea (fix-request) is to build a custom symbol from a synthetic with a formula.

I've now commented out this cloning, but even though the formula is now not visible in the properties, the resulting custom symbol seems to still clone the synthetic bars in some sort of mangled form. I don't understand what's going on yet.

ZЫ. I removed my generator program, but the custom symbol generated by it continues to be updated by ticks synchronously with the synthetic on the basis of which it was created. Poltergeist. There is a terminal glitch.

 
Stanislav Korotky #:

The challenge is questionable. Usually custom symbols in MQL5 calculate bars and ticks by themselves, and transferring the formula makes it impossible to manage a new symbol. The idea (fiche-request) is to build a custom symbol from a synthetic with a formula.

It may indeed not be worth doing a full cloning.

I have now commented out this cloning, but even though the formula is now not visible in the properties, the resulting custom symbol seems to still clone the synthetic bars in some sort of mangled form. I don't understand what's going on yet.

ZЫ. I removed my generator program, but the custom symbol generated by it continues to be updated by ticks synchronously with the synthetic on the basis of which it was created. Poltergeist. There is a terminal glitch.

There are a lot of bugs there, unfortunately.

 

@fxsaber

Sometimes after restarting the terminal the tester stops opening positions on a custom symbol.

Or counts zero profit.

What can it be connected with ?

Files:
4y48yl.PNG  32 kb
y4xlvu2.PNG  35 kb
 

Look at the currencies of the symbol BEFORE and AFTER the Terminal reboot...

I once had to write a Service to automatically restore custom ones.

 
fxsaber #:

Look at the currencies of the symbol BEFORE and AFTER the Terminal is rebooted....

I once had to write a Service to automatically restore custom ones.

Now even if I delete all created custom symbols from the terminal and delete the folder with custom bases, a failed custom symbol is still created.

I create a custom symbol with this code

// Create a copy of the symbol to speed up the Tester
#property script_show_inputs

#include <Symbol.mqh>

void OnStart()
{
  const SYMBOL Symb("TESTER_" + _Symbol); // Created a symbol

  if (Symb.IsExist()) // If the symbol is created
  {
    Symb = _Symbol; // Copied all properties and bar history (+ tick history if custom) from the main symbol - clone

    // Make the currencies of the symbol the currency of the account
    Symb.SetProperty(SYMBOL_CURRENCY_PROFIT, AccountInfoString(ACCOUNT_CURRENCY));
    Symb.SetProperty(SYMBOL_CURRENCY_MARGIN, AccountInfoString(ACCOUNT_CURRENCY));

    if (Symb.On()) // Included in the Market Watch
      ChartOpen(Symb.Name, PERIOD_CURRENT); // Opened a new symbol chart
  }
}

If your service is the solution to the problem - please share

 

Now I have installed terminal on a new virtualisation and the problem is the same.

Maybe there is something in the latest builds ?

 

I think I found the problem-

If you create a symbol with the name

EURUSD_1

Everything is fine.

If you create a symbol with the name

1_EURUSD

Then the hell happens.

Files:
1.PNG  90 kb
2.PNG  91 kb
 
EgorKim custom symbol currencies after Terminal reload.
// The service corrects the currencies of all custom characters.
#property service

bool CorrectCurrency( const string Symb, const string Currency )
{  
  return(SymbolInfoInteger(Symb, SYMBOL_CUSTOM) && 
         CustomSymbolSetString(Symb, SYMBOL_CURRENCY_BASE, Currency) &&
         CustomSymbolSetString(Symb, SYMBOL_CURRENCY_MARGIN, Currency) &&
         CustomSymbolSetString(Symb, SYMBOL_CURRENCY_PROFIT, Currency));
}

void CorrectSymbols( void )
{
  const string Currency = AccountInfoString(ACCOUNT_CURRENCY);
  
  for (int i = SymbolsTotal(false) - 1; i >= 0; i--)
    CorrectCurrency(SymbolName(i, false), Currency);
    
  return;
}

void OnStart()
{
  CorrectSymbols();
}
 
EgorKim #:

1_EURUSD

then the hell happens.

This is if the symbol's margin is calculated as on Forex, in other variants of margin calculation a custom symbol can be called whatever you want.