Two orders with the same ticket number - page 4

 
Enrique Dangeroux #:

Checking last is best if you have to. I use unique magic for each ea as wel as per symbol. I can leave out checking for it. But you can encode the symbol into the magic. You do need some kind of system for that.

But like i said. Nitpicking. How much work to shave of some microseconds.

Ah, I see. Indeed, you could add some integer hash of the symbol name to the magic number.

I like hand-picked human readable magic numbers. I run several EAs in parallel on multiple VPSes. To keep track, I like to select the magic numbers myself. It helps to filter in FxBlue, and ensure that each VPS has its own range of magic numbers.

Thanks for your help.
 
Enrique Dangeroux #:

No, i use unique magic per symbol. But William gave an example recently.

Different timeframe, different symbol, they are all apples.

interesting , something along those lines ?

#property version   "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
  ulong myMagic=0;
  if(assetToCode(32,myCurrencies,myTFS,myMagic)){
  Print("This ea will use Magic number "+IntegerToString(myMagic));
  }else{
  Print("Could not produx magic number");
  return(INIT_FAILED);
  }
//---
   return(INIT_SUCCEEDED);
  }
string myCurrencies[]={"AUD","EUR","USD"};
ENUM_TIMEFRAMES myTFS[]={PERIOD_M1,PERIOD_M5,PERIOD_H1,PERIOD_D1};
bool assetToCode(ushort prefix,
                 string &_currencies[],
                 ENUM_TIMEFRAMES &_tfs[],
                 ulong &result){
result=0;
string base=SymbolInfoString(_Symbol,SYMBOL_CURRENCY_BASE);
string quote=SymbolInfoString(_Symbol,SYMBOL_CURRENCY_PROFIT);
int f_base_symbol=-1,f_quote_symbol=-1,f_tf=-1;
for(int i=0;i<ArraySize(_currencies);i++){
if(f_base_symbol==-1&&_currencies[i]==base){f_base_symbol=i;}
if(f_quote_symbol==-1&&_currencies[i]==quote){f_quote_symbol=i;}
if(f_base_symbol!=-1&&f_quote_symbol!=-1){break;}
}
if(f_base_symbol!=-1&&f_quote_symbol!=-1){
for(int i=0;i<ArraySize(_tfs);i++){
if(_Period==_tfs[i]){
f_tf=i;break;
}}
if(f_tf!=-1){
string s_result=IntegerToString(prefix)+IntegerToString(f_base_symbol)+IntegerToString(f_quote_symbol)+IntegerToString(f_tf);
result=(ulong)StringToInteger(s_result);
return(true);
}
}
return(false);
}
 
Lorentzos Roussos #:

interesting , something along those lines ?

Something like that yes.

As Yoriz pointed out. It is very personal and depends on your workflow. He likes hand picked numbers because of fxblue. I don't care about the number because my workflow allows for it.

So do what fits your particular workflow best i guess.

 
Enrique Dangeroux #:

Something like that yes.

As Yoriz pointed out. It is very personal and depends on your workflow. He likes hand picked numbers because of fxblue. I don't care about the number because my workflow allows for it.

So do what fits your particular workflow best i guess.

yeah

 
Thank you all for your help. I have reported the bug at MetaQuotes.
 

Forum on trading, automated trading systems and testing trading strategies

OrderSend returns wrong ticket

Renat Fatkhullin , 2023.01.20 15:05

Fixed, will be in the next beta

The mistake was that at the same time two terminals sent two identical applications and they merged in the queue.