Hello Slawa,
I understand that, thank you for your input. I would like to put forward a test case to see if I understand the inner workings of MT Indicators and Strategies. Please if I have something wrong please correct me.
I know that many ticks can happen within a single block of time i.e. 15mins. If I have built all Time Frame data off 1 Minute data and never allow system to connect to the internet so it cant get any new data, then what I have is all there is for the indicators and stategies to work with.
I have a 15min chart built as explained above and place a simple MA supplied within MT and then I can see what the values are for each bar. There is no new data coming into MT.
When run this expert which calls the same Moving Average about 70-80% of the bars have diffent values that when I look at the MA on the chart.
I understand that, thank you for your input. I would like to put forward a test case to see if I understand the inner workings of MT Indicators and Strategies. Please if I have something wrong please correct me.
I know that many ticks can happen within a single block of time i.e. 15mins. If I have built all Time Frame data off 1 Minute data and never allow system to connect to the internet so it cant get any new data, then what I have is all there is for the indicators and stategies to work with.
I have a 15min chart built as explained above and place a simple MA supplied within MT and then I can see what the values are for each bar. There is no new data coming into MT.
When run this expert which calls the same Moving Average about 70-80% of the bars have diffent values that when I look at the MA on the chart.
//+------------------------------------------------------------------+ //| Test Tester.mq4 | //| Emerald King | //| info@emerald-king.com | //+------------------------------------------------------------------+ #property copyright "Emerald King" #property link "info@emerald-king.com" datetime MyTime = 0; double MyMA = 0; int MyDigits = 0; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { MyDigits = MarketInfo(Symbol(), MODE_DIGITS); return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { if ( MyTime != Time[0] ) { MyTime = Time[0]; MyMA = iMA(NULL, 0, 3, 0, 0, 0, 0); Print(TimeToStr(Time[0], TIME_DATE|TIME_MINUTES) + ", " + DoubleToStr(NormalizeDouble(MyMA,MyDigits),MyDigits) ); } return(0); } //+------------------------------------------------------------------+
Can you explain why this happens?
Slawa,
I think this happens because when calling the MA with a shift of 0 from the EA it is calculating the value and including the first tick of the new bar. When I use a shift of 1 the value it displays for this bar always 100% matches the MA value of the previous bar.
I think that solves my problem
Thank you Slawa,
EK
I think this happens because when calling the MA with a shift of 0 from the EA it is calculating the value and including the first tick of the new bar. When I use a shift of 1 the value it displays for this bar always 100% matches the MA value of the previous bar.
I think that solves my problem
Thank you Slawa,
EK
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Here is what I have done;
I have MT4 build 201 Not Connected to the internet
Downloaded 1 year’s history of 1 min data for a single symbol
Ran period converter script for all times frames to include 3 min to monthly
Have Indicator output to file Date, Time, and Values
Have EA call indicator and output values of the call with Date & Time
Only have run in back tester on all 3 models (every tick, control points and open prices)
Tried running test on all available data and selected time ranges
My Problem
The return values of the call to the indicator from within the EA has different values for the same time stamp as the values from the output to file from within the indicator.
So I am looking for any helpful hints that might point me in the right direction as to why this is happening and how to fix it. I am not willing to share my code.
Thank you
EK