Two discrepancies in Strategy Tester

 
DISCREPANCY 1
First, before testing I use F2 to download the M1 symbol data.
I´m using the combination of CCI(4) and RSI(4) as filter. But, CCI(4) is not calculated well in Strategy Tester: 
      //--- RSI filter
      RSI_1=0.0; RSI_2=0.0; // =0.0 doesn`t help
      RSI_1=NormalizeDouble(iRSI(NULL,0,4,PRICE_CLOSE,1),Digits); // NormalizeDouble doesn`t help
      RSI_2=NormalizeDouble(iRSI(NULL,0,4,PRICE_CLOSE,2),Digits); // NormalizeDouble doesn`t help

      //--- CCI filter
      CCI_1=0.0; CCI_2=0.0; // =0.0 doesn`t help
      CCI_1=NormalizeDouble(iCCI(NULL,0,4,PRICE_CLOSE,1),Digits); // NormalizeDouble doesn`t help
      CCI_2=NormalizeDouble(iCCI(NULL,0,4,PRICE_CLOSE,2),Digits); // NormalizeDouble doesn`t help

The conditions to PREPARE a Trade With the Trend Sell position:

      //--- Sell TWT
      //if(Blue_2>Blue_1 && (C1>RedLo_1 || C2>RedLo_2) && (RSI_1>70 || RSI_2>70) && (CCI_1>100 || CCI_2>100)) // doesn`t help
      if(Blue_2>Blue_1 && (C1>RedLo_1 || C2>RedLo_2) && ((RSI_1>70 && CCI_1>100) || (RSI_2>70 && CCI_2>100))) // doesn`t help
        {
         //--- set ENTRY, TP, SL
         orders[SellOpen]=NormalizeDouble(Low[iLowest(NULL,0,MODE_LOW,2,1)],Digits);
         orders[SellTP]=NormalizeDouble(Blue_0,Digits);
         // orders[SellSL]=NormalizeDouble(orders[SellOpen]+((orders[SellOpen]-orders[SellTP])/2)+maxSPREAD*Point,Digits);// RRR 2:1
         orders[SellSL]=NormalizeDouble(orders[SellOpen]+((orders[SellOpen]-orders[SellTP])+maxSPREAD*Point),Digits);// RRR 1:1
         //--- error 130 check
         if(orders[SellOpen]-orders[SellTP]<maxSTOPLEVEL*Point) orders[SellTP]=NormalizeDouble(orders[SellOpen]-maxSTOPLEVEL*Point,Digits);
         if(orders[SellSL]-orders[SellOpen]<maxSTOPLEVEL*Point) orders[SellSL]=NormalizeDouble(orders[SellOpen]+maxSTOPLEVEL*Point,Digits);
         //--- 
         SellSignals++; commentCount++; totalCount++;
         //commentList("\n"+IntegerToString(commentCount,0)+"#"+IntegerToString(totalCount)+" "+PREFIX+trend+"  "+_short+" ("+IntegerToString(SellSignals,0)+")");
         commentList("\n"+"#"+IntegerToString(totalCount)+" "+PREFIX+trend+"  "+_short+" ("+IntegerToString(SellSignals,0)+")");
        }

 The conditions to OPEN a Trade With the Trend (Sell) position:

The conditions to OPEN a Trade With the Trend (Sell) position:
//--- TRADING   CHECK FOR OPEN --------------------------------------+
   if(lastTrade!=Time[0])
     {
      if(orders[BuyOpen]>0.0 && Ask>orders[BuyOpen] && orders[BuyOpen]<Blue_0)
        {
         //--- open Buy
         tradePlaced=(EA_Enabled) ? Buy(orders[BuySL],orders[BuyTP]) : true;
         //--- save last trade time
         if(tradePlaced) lastTrade=Time[0];
        }
      if(orders[SellOpen]>0.0 && Bid<orders[SellOpen] && orders[SellOpen]>Blue_0)
        {
         //--- open Sell
         tradePlaced=(EA_Enabled) ? Sell(orders[SellSL],orders[SellTP]) : true;
         //--- save last trade time
         if(tradePlaced) lastTrade=Time[0];
        }
     }

 

See the image. At both vertical lines, CCI(4) did not meet the Sell condition.

CCI(4) was below treshold 100 on bar[1] and below bar[2]. Not above 100!

Despite these false conditions, Strategy Tester opened a Sell position. 

 

That would be very bad when live trading in automatic mode.....

 

And Yes, it went wrong:

 

Last but not least:

I rebooted my computer, the problem persisted.

Did MT4 uninstall and reboot before reinstall,  the problem persisted.

I think I have correct code and tested various ways to ensure normalized data.....

What is wrong? I think it is in Strategy Tester.

 


DISCREÀNCY 2 

Same trade as in DISCREPANCY 1 

In Journal all trade info is displayed according Digits:

 

 In Results all trade info is NOT displayed according Digits (TRUNCATED):

 

 Again:

I rebooted my computer, the problem persisted.

Did MT4 uninstall and reboot before reinstall,  the problem persisted.

I think I have correct code and tested various ways to ensure normalized data.....

What is wrong? I think it is in Strategy Tester.

 

I´ll notify Service Desk. Any help is welcome. 

 

Don't place your RSI and CCI on the same window, there is a scale issue on visual display.

Also print the values in your EA to check them.

 

Thanks for your fast reply Alain, but the problem persist (i have notified Service Desk)

It make no difference..... 

 
Thanks for the Print Log hint Alain.
Indeed it shows CCI(4) > 100 in LOG.

However, the problem remains.

What causes the discepancy 
- between Print LOG value (retrieved OnTick Strategy Tester calculation)
- and value in DATA window
- and CCI Graph value/curve in indicator subwindow?

Concrete, WHEN does one read WHAT value? 

Or, how many INDIVIDUAL calculations are made by MT4 Terminal for:
- OnTick as shown in Print Log
- ?? for Graph subwindow
- ?? for Data window ?

And -vital for EA logic development- which calculation to trust?

2015.12.14 13:48:23.533 2015.07.29 07:19  MBFX EA GBPUSD,H4: modify #1 sell 0.10 GBPUSD at 1.55939 sl: 1.56874 tp: 1.55018 ok
2015.12.14 13:48:23.533 2015.07.29 07:19  MBFX EA GBPUSD,H4: open #1 sell 0.10 GBPUSD at 1.55939 ok


2015.12.14 13:48:19.148 2015.07.29 04:00  MBFX EA GBPUSD,H4: CCI_2 2015.07.29 04:00  GBPUSD  H4    130.55556  <----
2015.12.14 13:48:19.148 2015.07.29 04:00  MBFX EA GBPUSD,H4: CCI_1 2015.07.29 04:00  GBPUSD  H4    73.76147
2015.12.14 13:48:19.148 2015.07.29 04:00  MBFX EA GBPUSD,H4: RSI_2 2015.07.29 04:00  GBPUSD  H4    80.25677
2015.12.14 13:48:19.148 2015.07.29 04:00  MBFX EA GBPUSD,H4: RSI_1 2015.07.29 04:00  GBPUSD  H4    81.35546


2015.12.14 13:48:13.782 2015.07.29 00:00  MBFX EA GBPUSD,H4: CCI_2 2015.07.29 00:00  GBPUSD  H4    81.93833
2015.12.14 13:48:13.782 2015.07.29 00:00  MBFX EA GBPUSD,H4: CCI_1 2015.07.29 00:00  GBPUSD  H4    130.55556  <----
2015.12.14 13:48:13.782 2015.07.29 00:00  MBFX EA GBPUSD,H4: RSI_2 2015.07.29 00:00  GBPUSD  H4    72.56297
2015.12.14 13:48:13.782 2015.07.29 00:00  MBFX EA GBPUSD,H4: RSI_1 2015.07.29 00:00  GBPUSD  H4    80.25677


2015.12.14 13:47:43.702 2015.07.28 12:00  MBFX EA GBPUSD,H4: CCI_2 2015.07.28 12:00  GBPUSD  H4    -36.52968
2015.12.14 13:47:43.702 2015.07.28 12:00  MBFX EA GBPUSD,H4: CCI_1 2015.07.28 12:00  GBPUSD  H4    133.33333
2015.12.14 13:47:43.702 2015.07.28 12:00  MBFX EA GBPUSD,H4: RSI_2 2015.07.28 12:00  GBPUSD  H4    57.57431
2015.12.14 13:47:43.702 2015.07.28 12:00  MBFX EA GBPUSD,H4: RSI_1 2015.07.28 12:00  GBPUSD  H4    75.40472

2015.12.14 13:47:23.082 2015.07.28 04:00  Custom indicator MBFX System GBPUSD,H4: loaded successfully
2015.12.14 13:47:18.533 2015.07.28 00:00  MBFX EA inputs: EA_Enabled=1; LotSize=0.1; Slippage=3; mbfxBars=120; mbfxOrder=3; mbfxEcart=1.61803399; dtformat=1; alertppup=0; 

DEBUG=0;