Download MetaTrader 5

wrong number for options deal

To add comments, please log in or register
All activity at MQL5.community is clearly visible. Have a look at the Wall!
meuparana
20
meuparana 2015.06.11 21:51 
#property copyright "Copyright 2015, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"

static long hisTickVolume[];
 
void OnTick() {
  
  GetHistoricoQtdeNegocio();
  
}

void GetHistoricoQtdeNegocio() {
 
  string opcaoOperar = "VALEF";
  string opcaoFull = " ";
  int strike = 0;
   
  ArraySetAsSeries(hisTickVolume,true);
  for (strike = 5; strike < 100; strike++) {
    if (strike < 10)
       opcaoFull = opcaoOperar + IntegerToString(strike, 1);
     else
       opcaoFull = opcaoOperar + IntegerToString(strike, 2); 
  //   Print(opcaoFull);     

     CopyTickVolume(opcaoFull,PERIOD_D1,0,2,hisTickVolume);
     Print(opcaoFull,": ", hisTickVolume[0]);
   }
}
Result:


2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF99: 7 -> wrong deal number -> 0
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF98: 7 -> wrong deal number -> 0
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF97: 7 -> wrong deal number -> 0
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF96: 7 -> wrong deal number -> 0
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF95: 7 -> wrong deal number -> 0
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF94: 7 ...
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF93: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF92: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF91: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF90: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF89: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF88: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF87: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF86: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF85: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF84: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF83: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF82: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF81: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF80: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF79: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF78: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF77: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF76: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF75: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF74: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF73: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF72: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF71: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF70: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF69: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF68: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF67: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF66: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF65: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF64: 7
2015.06.11 16:34:34.445 QtdeNegocios (VALEF18,M15) VALEF63: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF62: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF61: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF60: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF59: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF58: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF57: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF56: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF55: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF54: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF53: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF52: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF51: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF50: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF49: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF48: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF47: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF46: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF45: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF44: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF43: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF42: 7
2015.06.11 16:34:34.444 QtdeNegocios (VALEF18,M15) VALEF41: 7
2015.06.11 16:34:05.123 QtdeNegocios (VALEF18,M15) VALEF40: 7
2015.06.11 16:34:05.123 QtdeNegocios (VALEF18,M15) VALEF39: 7
2015.06.11 16:34:05.123 QtdeNegocios (VALEF18,M15) VALEF38: 7
2015.06.11 16:34:05.123 QtdeNegocios (VALEF18,M15) VALEF37: 7
2015.06.11 16:34:05.123 QtdeNegocios (VALEF18,M15) VALEF36: 7
2015.06.11 16:34:05.122 QtdeNegocios (VALEF18,M15) VALEF35: 7
2015.06.11 16:33:18.304 QtdeNegocios (VALEF18,M15) VALEF34: 7
2015.06.11 16:33:18.304 QtdeNegocios (VALEF18,M15) VALEF33: 7
2015.06.11 16:33:18.304 QtdeNegocios (VALEF18,M15) VALEF32: 7
2015.06.11 16:33:18.304 QtdeNegocios (VALEF18,M15) VALEF31: 7
2015.06.11 16:33:18.304 QtdeNegocios (VALEF18,M15) VALEF30: 7
2015.06.11 16:33:18.304 QtdeNegocios (VALEF18,M15) VALEF29: 7
2015.06.11 16:33:18.304 QtdeNegocios (VALEF18,M15) VALEF28: 7
2015.06.11 16:33:18.304 QtdeNegocios (VALEF18,M15) VALEF27: 7
2015.06.11 16:32:31.511 QtdeNegocios (VALEF18,M15) VALEF26: 7

2015.06.11 16:32:31.511 QtdeNegocios (VALEF18,M15) VALEF25: 7 ....

2015.06.11 16:31:44.691 QtdeNegocios (VALEF18,M15) VALEF24: 7...

2015.06.11 16:31:44.691 QtdeNegocios (VALEF18,M15) VALEF23: 7 ...
2015.06.11 16:31:44.691 QtdeNegocios (VALEF18,M15) VALEF22: 7 -> wrong deal number -> 0 (copy from VALEF21)
2015.06.11 16:30:57.865 QtdeNegocios (VALEF18,M15) VALEF21: 7
2015.06.11 16:30:51.217 QtdeNegocios (VALEF18,M15) VALEF20: 2146
2015.06.11 16:30:04.383 QtdeNegocios (VALEF18,M15) VALEF19: 2146
2015.06.11 16:30:04.283 QtdeNegocios (VALEF18,M15) VALEF18: 11111
2015.06.11 16:30:04.283 QtdeNegocios (VALEF18,M15) VALEF17: 1644
2015.06.11 16:30:04.182 QtdeNegocios (VALEF18,M15) VALEF16: 244
2015.06.11 16:30:04.076 QtdeNegocios (VALEF18,M15) VALEF15: 66
2015.06.11 16:30:03.972 QtdeNegocios (VALEF18,M15) VALEF14: 15
2015.06.11 16:29:58.430 QtdeNegocios (VALEF18,M15) VALEF13: 16
2015.06.11 16:29:08.165 QtdeNegocios (VALEF18,M15) VALEF12: 16
2015.06.11 16:29:08.063 QtdeNegocios (VALEF18,M15) VALEF11: 2
2015.06.11 16:29:08.062 QtdeNegocios (VALEF18,M15) VALEF10: 2
2015.06.11 16:29:08.062 QtdeNegocios (VALEF18,M15) VALEF9: 2
2015.06.11 16:29:08.062 QtdeNegocios (VALEF18,M15) VALEF8: 2
2015.06.11 16:29:08.062 QtdeNegocios (VALEF18,M15) VALEF7: 2
2015.06.11 16:29:08.062 QtdeNegocios (VALEF18,M15) VALEF6: 2
2015.06.11 16:29:08.062 QtdeNegocios (VALEF18,M15) VALEF5: 2
2015.06.11 16:30:57.865 QtdeNegocios (VALEF18,M15) VALEF21: 7
2015.06.11 16:30:51.217 QtdeNegocios (VALEF18,M15) VALEF20: 2146
2015.06.11 16:30:04.383 QtdeNegocios (VALEF18,M15) VALEF19: 2146
2015.06.11 16:30:04.283 QtdeNegocios (VALEF18,M15) VALEF18: 11111
2015.06.11 16:30:04.283 QtdeNegocios (VALEF18,M15) VALEF17: 1644
2015.06.11 16:30:04.182 QtdeNegocios (VALEF18,M15) VALEF16: 244
2015.06.11 16:30:04.076 QtdeNegocios (VALEF18,M15) VALEF15: 66
2015.06.11 16:30:03.972 QtdeNegocios (VALEF18,M15) VALEF14: 15
2015.06.11 16:29:58.430 QtdeNegocios (VALEF18,M15) VALEF13: 16
2015.06.11 16:29:08.165 QtdeNegocios (VALEF18,M15) VALEF12: 16
2015.06.11 16:29:08.063 QtdeNegocios (VALEF18,M15) VALEF11: 2
2015.06.11 16:29:08.062 QtdeNegocios (VALEF18,M15) VALEF10: 2
2015.06.11 16:29:08.062 QtdeNegocios (VALEF18,M15) VALEF9: 2
2015.06.11 16:29:08.062 QtdeNegocios (VALEF18,M15) VALEF8: 2
2015.06.11 16:29:08.062 QtdeNegocios (VALEF18,M15) VALEF7: 2 -> ....
2015.06.11 16:29:08.062 QtdeNegocios (VALEF18,M15) VALEF6: 2 -> wrong deal number -> 0
2015.06.11 16:29:08.062 QtdeNegocios (VALEF18,M15) VALEF5: 2 -> wrong deal number, -> 0
Alain Verleyen
Moderator
30739
Alain Verleyen 2015.06.11 22:09  

Forum on trading, automated trading systems and testing trading strategies


Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.


Alain Verleyen
Moderator
30739
Alain Verleyen 2015.06.11 22:17  
You have to check the return value of CopyTickVolume(). -1 means an error, please check the documentation.
meuparana
20
meuparana 2015.06.12 03:13  
#property copyright "Copyright 2015, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"

static long hisTickVolume[];
 
void OnTick() {
  
  GetHistoricoQtdeNegocio();
  
}

void GetHistoricoQtdeNegocio() {
 
  string opcaoOperar = "VALEF";
  string opcaoFull = " ";
  int strike = 0;
   
  ArraySetAsSeries(hisTickVolume,true);
  for (strike = 5; strike < 100; strike++) {
    if (strike < 10)
       opcaoFull = opcaoOperar + IntegerToString(strike, 1);
     else
       opcaoFull = opcaoOperar + IntegerToString(strike, 2); 
  //   Print(opcaoFull);     

     CopyTickVolume(opcaoFull,PERIOD_D1,0,2,hisTickVolume);
     Print(opcaoFull,": ", hisTickVolume[0]);
   }
}
}
To add comments, please log in or register