Ichimoku Chikouspan Probelm

 

I noticed something strange thinks When I try to get the value of the Chikouspan 26 bars before. It only works in live mode correct.

But not in the backtester. In Backtester i get strange Values.

I use this Code for geting the Value :


if(CopyBuffer(Ichimoku_handle_Long, CHIKOUSPAN_LINE, 26, 200, Ichimoku_Chikou_Long) <= 0)

return;

ArraySetAsSeries(Ichimoku_Chikou_Long, true);



Print("Ichumuko Chiku_0 = ",Ichimoku_Chikou_Long[0]);

Print("Ichumuko Chiku_1 = ",Ichimoku_Chikou_Long[1]);



Has enyone the same Problem ?

How can i get the correct Value for the Chikouspan Line 26 Bars bevor ?


Testing trading strategies on real ticks
Testing trading strategies on real ticks
  • www.mql5.com
The article provides the results of testing a simple trading strategy in three modes: "1 minute OHLC", "Every tick" and "Every tick based on real ticks" using actual historical data.
 
Try putting ArraySetAsSeries before CopyBuffer maybe that helps.
 
  1. ASAS before filling, as the example shows.

  2. Please edit your (original) post and use the CODE button (or Alt+S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
              Messages Editor

 
Hey Dan 

I had a very similar issue to yours hopefully the resolution might help.

Problem: My Ichimoku indicator function was created with a function for each individual componant (i.e. TenkanSen, KijunSen etc.). My other functions worked fine but I could not get the right results for the ChikouSpan Value. 

Resolution: 
What I found to work was increasing the 'start_pos' parameter for the CopyBuffer() function by 1 so in your case it could be: 

if(CopyBuffer(Ichimoku_handle_Long, CHIKOUSPAN_LINE, 27, 200, Ichimoku_Chikou_Long) <= 0)

So I think it works like the following 

Candle 0 = 26 bars back
Candle 1 = 27 bars back
Candle 2 = 28 bars back and so on

I think its how the indicator counts 26 candles back. I think it starts '1' as the next completed candle and not the current candle. 

Any ways i tested this on my indicator and it worked finally - came back with the correct values. 

Good luck and I hope this helps 
Reason: