CopyTime(NULL, PERIOD_D1, 0, nDays, dc); ArraySetAsSeries(dc, true);
-
Why are you calling those nDays times? Once is enough.
- Don't use NULL.
- On MT4, you can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not. OrderSend does not. On MT5 only № 2.
- Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.
- Zero is the same as PERIOD_CURRENT which means _Period. Don't hard code numbers.
- MT4: No need for a function call with iHigh(NULL,0,s) just use the predefined arrays, i.e. High[].
- On MT4, you can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not. OrderSend does not. On MT5 only № 2.
- Check your return codes. On MT5: Unless the chart is that specific pair/TF, you must Synchronize the terminal Data from the Server.
Is it mystical?! It is! - Withdraw - Technical Indicators - MQL5 programming forum
Timeseries and Indicators Access / Data Access - Reference on algorithmic/automated trading language for MetaTrader 5
Synchronize Server Data with Terminal Data - Symbols - General - MQL5 programming forum
SymbolInfoInteger doesn't work - Symbols - General - MQL5 programming forum 2019.09.03
OnCalculate during weekend MT5 - General - MQL5 programming forum
-
Why are you calling those nDays times? Once is enough.
- Don't use NULL.
- On MT4, you can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not. OrderSend does not. On MT5 only № 2.
- Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.
- Zero is the same as PERIOD_CURRENT which means _Period. Don't hard code numbers.
- MT4: No need for a function call with iHigh(NULL,0,s) just use the predefined arrays, i.e. High[].
- On MT4, you can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not. OrderSend does not. On MT5 only № 2.
- Check your return codes. On MT5: Unless the chart is that specific pair/TF, you must Synchronize the terminal Data from the Server.
Is it mystical?! It is! - Withdraw - Technical Indicators - MQL5 programming forum
Timeseries and Indicators Access / Data Access - Reference on algorithmic/automated trading language for MetaTrader 5
Synchronize Server Data with Terminal Data - Symbols - General - MQL5 programming forum
SymbolInfoInteger doesn't work - Symbols - General - MQL5 programming forum 2019.09.03
OnCalculate during weekend MT5 - General - MQL5 programming forum
Hello,
Please, I am finding it difficult to repeat the box drawn on "x" amount of days, then also change the time to the current time in my plot, Using print function it is showing my time is 1970.01.01. Am still learning and this is the first code am writing with mql 5.
The Value of the days is changing but getting the time to change(from 00:00) on those days is what am finding difficult. The Rectangle is drawn only on the recent day. Thanks
What I have learnt now that am done, It may help someone confused someday.
1) You do not really buffers to plot or draw a rectangle as in my case above.
2) Buffers are plotted in pairs of (0,1) (2,3) {as seen when you use the command below}. When only one buffer is defined, the buffer together with the origin line are used to plot your data.
//--- What it does is assign your buffer to a number SetIndexBuffer();
3) When using, to create, more than one object eg Rectangle (OBJ_RECTANGLE), you need to program a unique name for each, if not only one would be created (I struggled here).
//--- Creating of graphical Objects ObjectCreate();
4) To get the object to be created in previous date, use a time function such that the , start and end period (time1 and time2) are added to the current bar time iTime[0], with that you would have less headache.
Goodluck
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
Please, I am finding it difficult to repeat the box drawn on "x" amount of days, then also change the time to the current time in my plot, Using print function it is showing my time is 1970.01.01. Am still learning and this is the first code am writing with mql 5.
The Value of the days is changing but getting the time to change(from 00:00) on those days is what am finding difficult. The Rectangle is drawn only on the recent day. Thanks