I was testing my EA with the build in Strategy Tester from MetaTreader 4. I recognized that my EA placed far too few orders because of missed trend signs. After checking the chart by my own, I realized that my EA processed the Tenken-sen wrong.
Therefore I printed the retrieved Tenken-sen values with Alert(...) and wrote down the values from the chart. Strangely I spotted non equal values. Check code for all alerted and chart values.
I have no idea why there are this two "wrong" values. Maybe it's because of my "new bar" identification?
In addition I think especially at strong changes of the Tenkan-sen I get wrong values and with shift period 1 I always get the correct values.
Code and values:
Alain Verleyen:
Because Bar 0 (current
open bar) value can change. In your journal Tenkan-sen(0) is the value at the opening of bar 0. On the chart, while looking at bar's value,
what you see is the value when the bar is close.
Ohhhh Ok, thank you Alain for taking the time!
So at a new bar event I should use the function with shift period 1 to get the correct "past" Tenkan-sen?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I was testing my EA with the build in Strategy Tester from MetaTreader 4. I recognized that my EA placed far too few orders because of missed trend signs. After checking the chart by my own, I realized that my EA processed the Tenken-sen wrong.
Therefore I printed the retrieved Tenken-sen values with Alert(...) and wrote down the values from the chart. Strangely I spotted non equal values. Check code for all alerted and chart values.
I have no idea why there are this two "wrong" values. Maybe it's because of my "new bar" identification?
In addition I think especially at strong changes of the Tenkan-sen I get wrong values and with shift period 1 I always get the correct values.
Code and values: