I spent so much time on the Book I do not think I yet get it.
Lets say I want to compare current calculation results with previously taken. I store all results, when new one come in I compare them to the last stored.
My attempt to code arrays
What I need to do to find the Last stored results?
Read the docs about arrays with al ot of examples!
Well i don't see any code that writes to the array so it's normal that it's value is zero ?
- www.mql5.com
I have read pretty much on that doc and book, not helping in my view, no examples only two examples on book which are not close.
The code that writes to the array might be just what I need at the moment to continue learning.
Thank You Anyway for helping.
You reserve 50 empty bottles,
The goal is to pour a liquid in them.
But you don't put anything in them and then ask the question, why is bottle 49 empty ?
you have to put something in to get a reading out of it....
Thank you Marco. But as I said I am Learning here. Your Questions are helpful, its what I need so that I go and learn more to answer the question you ask when I am wrong, and that is something one can never find in the Book or Documents.
//+------------------------------------------------------------------+ //| Print.mq4 | //| Copyright 2015, MetaQuotes Software Corp. | //| https://www.mql5.com | //+-----------------------------------------------------------Ndumiso+ #property copyright "Copyright 2015, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" double array[5],RT,UsePoint,Price=2; //+------------------------------------------------------------------+ //| Expert initialization function | //+-----------------------------------------------------------Ndumiso+ int OnInit() { //--- UsePoint = PipPoint(Symbol()); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+-----------------------------------------------------------Ndumiso+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+-----------------------------------------------------------Ndumiso+ void OnTick() { RT=NormalizeDouble(Bid-Price*UsePoint,Digits); for (int i=4; i>1; i--) { array[i]=array[i-1]; array[i-1] = RT; } Print("RT:",DoubleToStr(RT,Digits),"","PreviousRT:",DoubleToStr(array[2],Digits)); } //+------------------------------------------------------------------+ //| Broker Digits | //+-----------------------------------------------------------Ndumiso+ double PipPoint(string Currency) { int CalcDigits = MarketInfo(Currency,MODE_DIGITS); if(CalcDigits == 2 || CalcDigits == 3)double CalcPoint = 0.01; else if(CalcDigits == 4 || CalcDigits == 5) CalcPoint = 0.0001; return(CalcPoint); }
Your effort is much appreciated.
I have now filled the array with RT and element 2 seems to be the previous last stored value of RT.
With this Learned I shall move on to the next. Again thank you for taking your time to reply to our stupid calls.
Waiting for other questions if there is any on any wrong on my code that is not making any sense
Please read this article
- 2013.03.11
- Dmitry Fedoseev
- www.mql5.com
- 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 spent so much time on the Book I do not think I yet get it.
Lets say I want to compare current calculation results with previously taken. I store all results, when new one come in I compare them to the last stored.
My attempt to code arrays
What I need to do to find the Last stored results?