Expert doesn't work on US30 but works fine on eurusd

To add comments, please log in or register
Maciej Barszczak
154
Maciej Barszczak  

Hello,


I've wrote expert advisor. What could be a reason that my EA works fine on every forex pair but doesn't make any trade on US30?

I use IC markets. 

Maciej Barszczak
154
Maciej Barszczak  
Maciej Barszczak:

Hello,


I've wrote expert advisor. What could be a reason that my EA works fine on every forex pair but doesn't make any trade on US30?

I use IC markets. 

#include <Trade\Trade.mqh>

CTrade CT;

#include <Trade\PositionInfo.mqh>

CPositionInfo  Zysk; 



input bool kontrola_pozycji=false;

input double oczekiwany_zysk=3;



input bool kontrola_strat = false;

input double maksymalna_strata=3;







double      MA_1[];                // array for the indicator iMA

double      MA_2[];  

double      MA_3[];  

double      MA_4[];  



int         MA_handle;           // handle of the indicator iMA



input double    Loty = 0.1  ;

int Pozycja=0;







//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit()

  {

//---

     MA_handle=iCustom(NULL,0,"Corrected T3.ex5");

     

//---

   return(INIT_SUCCEEDED);

  }

//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {

//---

   

  }

//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+

void OnTick()

  {

//---

   

   CopyBuffer(MA_handle,1,0,100,MA_1);

   CopyBuffer(MA_handle,2,0,100,MA_2);

   CopyBuffer(MA_handle,3,0,100,MA_3);

   CopyBuffer(MA_handle,4,0,100,MA_4);

   

   

   

   

   if(Zysk.SelectByIndex(0)) ;

   double zyski = Zysk.Profit();

  

   

   if(kontrola_pozycji==true && zyski>oczekiwany_zysk)

   {

   

   CT.PositionClose(Symbol(),4);

   

   }

   

   if(kontrola_strat==true && zyski<(-1 * maksymalna_strata))

   {

   

   CT.PositionClose(Symbol(),4);

   

   }

   

   

   

   

   

   

   //int       indicator_handle,     // indicator handle

   //int       buffer_num,           // indicator buffer number

   //int       start_pos,            // start position

   //int       count,                // amount to copy

   //double    buffer[]              // target array to copy

   

   

   ArraySetAsSeries(MA_1,true);  

   ArraySetAsSeries(MA_2,true);  

   ArraySetAsSeries(MA_3,true);  

   ArraySetAsSeries(MA_4,true);  

   

   if(MA_1[1]<MA_2[1] && MA_1[0]>MA_2[0] && Pozycja<1)

      {

      

      if(Pozycja==-1)

      {

      CT.PositionClose(Symbol(),4);

      }

            

      CT.Buy(Loty);

      

      Print(CT.ResultRetcode());

      

      Pozycja=1;

      }

   

   

   if(MA_1[1]>MA_2[1] && MA_1[0]<MA_2[0] && Pozycja>-1)

   {

      if(Pozycja==1)

      {

      CT.PositionClose(Symbol(),4);

      }

      

      CT.Sell(Loty);

      

       Print(CT.ResultRetcode());

      

      

      Pozycja=-1;

   }

   

  }

//+------------------------------------------------------------------+


Keith Watford
Moderator
23357
Keith Watford  
Maciej Barszczak:

Hello,


I've wrote expert advisor. What could be a reason that my EA works fine on every forex pair but doesn't make any trade on US30?

I use IC markets. 

There is something wrong with your code.

Maciej Barszczak
154
Maciej Barszczak  
Keith Watford:

There is something wrong with your code.

Yes, I realize that. But what's wrong?

Fabio Cavalloni
7528
Fabio Cavalloni  

What errors do you get?

For sure you lack initialization of CT object.


CT.SetExpertMagicNumber(magic);

CT.SetDeviationInPoints(slippage);

CT.SetTypeFillingBySymbol(_Symbol);


In your OnInit

Maciej Barszczak
154
Maciej Barszczak  
Fabio Cavalloni:

What errors do you get?

For sure you lack initialization of CT object.


CT.SetExpertMagicNumber(magic);

CT.SetDeviationInPoints(slippage);

CT.SetTypeFillingBySymbol(_Symbol);


In your OnInit

It doesn't help :(

Maciej Barszczak
154
Maciej Barszczak  
Maciej Barszczak:

It doesn't help :(

EURUSD, GPBUSD - works

NZDUSD, US30 - doesn't work

I'm so confused.

Could anyone help me? 

amando
2882
amando  
Maciej Barszczak:

EURUSD, GPBUSD - works

NZDUSD, US30 - doesn't work

I'm so confused.

Could anyone help me? 

what does the log file says?

Maciej Barszczak
154
Maciej Barszczak  
amando:

what does the log file says?

2020.05.18 12:18:12.284 Core 1 login (build 2361)

2020.05.18 12:18:12.284 Core 1 account info found with currency USD

2020.05.18 12:18:12.284 Core 1 2748 bytes of input parameters loaded

2020.05.18 12:18:12.284 Core 1 expert file added: Experts\Equity\$Trend.ex5. 69247 bytes loaded

2020.05.18 12:18:12.284 Core 1 program file added: Indicators\Corrected T3.ex5. 29823 bytes loaded

2020.05.18 12:18:12.284 Core 1 calculate profit in pips, initial deposit 10000, leverage 1:500

2020.05.18 12:18:12.284 Core 1 successfully initialized

2020.05.18 12:18:12.284 Core 1 96 Kb of total initialization data received

2020.05.18 12:18:12.284 Core 1 Intel Core i3-3120M  @ 2.50GHz, 8085 MB

2020.05.18 12:18:12.284 Core 1 NZDUSD: symbol to be synchronized

2020.05.18 12:18:12.284 Core 1 NZDUSD: symbol synchronized, 3720 bytes of symbol info received

2020.05.18 12:18:12.284 Core 1 NZDUSD: load 1.98 Mb of history data to synchronize in 0:00:01.871

2020.05.18 12:18:12.284 Core 1 NZDUSD: history synchronized from 2019.01.02 to 2020.05.15

2020.05.18 12:18:12.284 Core 1 NZDUSD,M1: history cache allocated for 511627 bars and contains 495169 bars from 2019.01.02 00:00 to 2020.04.30 23:58

2020.05.18 12:18:12.284 Core 1 NZDUSD,M1: history begins from 2019.01.02 00:00

2020.05.18 12:18:12.284 Core 1 NZDUSD,M1 (ICMarkets-MT5): every tick generating

2020.05.18 12:18:12.284 Core 1 NZDUSD,M1: testing of Experts\Equity\$Trend.ex5 from 2020.05.01 00:00 to 2020.05.17 00:00 started with inputs:

2020.05.18 12:18:12.284 Core 1   kontrola_pozycji=false

2020.05.18 12:18:12.284 Core 1   oczekiwany_zysk=1

2020.05.18 12:18:12.284 Core 1   kontrola_strat=false

2020.05.18 12:18:12.284 Core 1   maksymalna_strata=3

2020.05.18 12:18:12.284 Core 1   Loty=0.1


And nothing more


amando
2882
amando  
Maciej Barszczak:

2020.05.18 12:18:12.284 Core 1 login (build 2361)

2020.05.18 12:18:12.284 Core 1 account info found with currency USD

2020.05.18 12:18:12.284 Core 1 2748 bytes of input parameters loaded

2020.05.18 12:18:12.284 Core 1 expert file added: Experts\Equity\$Trend.ex5. 69247 bytes loaded

2020.05.18 12:18:12.284 Core 1 program file added: Indicators\Corrected T3.ex5. 29823 bytes loaded

2020.05.18 12:18:12.284 Core 1 calculate profit in pips, initial deposit 10000, leverage 1:500

2020.05.18 12:18:12.284 Core 1 successfully initialized

2020.05.18 12:18:12.284 Core 1 96 Kb of total initialization data received

2020.05.18 12:18:12.284 Core 1 Intel Core i3-3120M  @ 2.50GHz, 8085 MB

2020.05.18 12:18:12.284 Core 1 NZDUSD: symbol to be synchronized

2020.05.18 12:18:12.284 Core 1 NZDUSD: symbol synchronized, 3720 bytes of symbol info received

2020.05.18 12:18:12.284 Core 1 NZDUSD: load 1.98 Mb of history data to synchronize in 0:00:01.871

2020.05.18 12:18:12.284 Core 1 NZDUSD: history synchronized from 2019.01.02 to 2020.05.15

2020.05.18 12:18:12.284 Core 1 NZDUSD,M1: history cache allocated for 511627 bars and contains 495169 bars from 2019.01.02 00:00 to 2020.04.30 23:58

2020.05.18 12:18:12.284 Core 1 NZDUSD,M1: history begins from 2019.01.02 00:00

2020.05.18 12:18:12.284 Core 1 NZDUSD,M1 (ICMarkets-MT5): every tick generating

2020.05.18 12:18:12.284 Core 1 NZDUSD,M1: testing of Experts\Equity\$Trend.ex5 from 2020.05.01 00:00 to 2020.05.17 00:00 started with inputs:

2020.05.18 12:18:12.284 Core 1   kontrola_pozycji=false

2020.05.18 12:18:12.284 Core 1   oczekiwany_zysk=1

2020.05.18 12:18:12.284 Core 1   kontrola_strat=false

2020.05.18 12:18:12.284 Core 1   maksymalna_strata=3

2020.05.18 12:18:12.284 Core 1   Loty=0.1


And nothing more


what does it say when you set an order on US30? did you check the lotstep and the tickstep?

Maciej Barszczak
154
Maciej Barszczak  
amando:

what does it say when you set an order on US30? did you check the lotstep and the tickstep?

2020.05.18 14:48:08.831 Core 1 agent process started on 127.0.0.1:3000

2020.05.18 14:48:08.831 Core 1 connecting to 127.0.0.1:3000

2020.05.18 14:48:09.833 Core 1 connected

2020.05.18 14:48:09.861 Core 1 authorized (agent build 2361)

2020.05.18 14:48:09.863 Tester US30,M1 (ICMarkets-MT5): testing of Experts\Equity\$Trend.ex5 from 2020.05.01 00:00 to 2020.05.17 00:00

2020.05.18 14:48:09.948 Core 1 common synchronization completed

2020.05.18 14:48:10.387 Tester quality of analyzed history is 100%

2020.05.18 14:48:16.061 Core 1 MetaTester 5 started on 127.0.0.1:3000

2020.05.18 14:48:16.061 Core 1 initialization finished

2020.05.18 14:48:16.061 Core 1 login (build 2361)

2020.05.18 14:48:16.061 Core 1 4372 bytes of account info loaded

2020.05.18 14:48:16.061 Core 1 1482 bytes of tester parameters loaded

2020.05.18 14:48:16.061 Core 1 2748 bytes of input parameters loaded

2020.05.18 14:48:16.061 Core 1 1766 bytes of symbols list loaded (120 symbols)

2020.05.18 14:48:16.061 Core 1 expert file added: Experts\Equity\$Trend.ex5. 69247 bytes loaded

2020.05.18 14:48:16.061 Core 1 program file added: Indicators\Corrected T3.ex5. 29823 bytes loaded

2020.05.18 14:48:16.061 Core 1 3730 Mb available, 46 blocks set for ticks generating

2020.05.18 14:48:16.061 Core 1 calculate profit in pips, initial deposit 10000, leverage 1:500

2020.05.18 14:48:16.061 Core 1 successfully initialized

2020.05.18 14:48:16.061 Core 1 98 Kb of total initialization data received

2020.05.18 14:48:16.061 Core 1 Intel Core i3-3120M  @ 2.50GHz, 8085 MB

2020.05.18 14:48:16.061 Core 1 US30: symbol to be synchronized

2020.05.18 14:48:16.061 Core 1 US30: symbol synchronized, 3920 bytes of symbol info received

2020.05.18 14:48:16.061 Core 1 US30: load 23 bytes of history data to synchronize in 0:00:00.001

2020.05.18 14:48:16.061 Core 1 US30: history synchronized from 2019.01.02 to 2020.05.15

2020.05.18 14:48:16.061 Core 1 US30,M1: history cache allocated for 477921 bars and contains 461464 bars from 2019.01.02 08:00 to 2020.04.30 23:59

2020.05.18 14:48:16.061 Core 1 US30,M1: history begins from 2019.01.02 08:00

2020.05.18 14:48:16.061 Core 1 US30,M1 (ICMarkets-MT5): every tick generating

2020.05.18 14:48:16.061 Core 1 US30,M1: testing of Experts\Equity\$Trend.ex5 from 2020.05.01 00:00 to 2020.05.17 00:00 started with inputs:

2020.05.18 14:48:16.061 Core 1   kontrola_pozycji=false

2020.05.18 14:48:16.061 Core 1   oczekiwany_zysk=1

2020.05.18 14:48:16.061 Core 1   kontrola_strat=false

2020.05.18 14:48:16.061 Core 1   maksymalna_strata=3

2020.05.18 14:48:16.061 Core 1   Loty=0.1


To add comments, please log in or register