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
Enums and a function to handle the 22 types of prices
Enums and a function to handle the 22 types of prices
Dearest MLADEN
Pretty thanks for being kind human.
regards
As simple as it gets open line display of any chose time frame :
Two ways of calculating standard deviation - both are single pass ways of calculating it (unlike the usual calculation mode that is used - which makes these two ways faster in calculation than the usual ways). Both include sample correction as an option (which makes these ways able of doing what should be done with standard deviation in the first place)
For those looking for an "old way" of getting prices in metatrader 5, here is this function
Using it is simple :
When you had, for example, Close[n], you should use getPrice(PRICE_CLOSE,n), and so on. It works exactly the same as in metatrader 4 (ie: when using 0 for n, it does not return the oldest price - as it would do if used in mt5 way of accessing buffers, but the used to current - newest - price, the way we are used to in metatrader 4)
Any more snippets that could help us using mt5?
There is one huge misunderstanding when it comes to what is accessible by using iCostom() calls
A lot of people think that if something is not displayed in the data window, it can not be retrieved using iCustom(). Which is simply not true. Any buffer used by a custom indicator can be accessed using iCustom(). Any. Here is a very simple code that will help you test that - and an example - the buffer displayed is eight buffer (buffer No. 7 in metatrader numbering) and,as it is obvious, even though that value is not displayed anywhere, it is containing values +1 and -1 for each and every color state
#property indicator_buffers 3
#property indicator_color1 clrSilver
#property indicator_color2 clrGray
#property indicator_color3 clrDimGray
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property strict
extern int BufferNumber1 = 0; // First buffer number (<0 to skip it)
extern int BufferNumber2 = -1; // Second buffer number (<0 to skip it)
extern int BufferNumber3 = -1; // Third buffer number (<0 to skip it)
extern string IndicatorName = "Enter indicator name"; // Indicator name to use
double Buffer1[],Buffer2[],Buffer3[];
//------------------------------------------------------------------
//
//------------------------------------------------------------------
//
//
//
//
//
int init()
{
SetIndexBuffer(0,Buffer1);
SetIndexBuffer(1,Buffer2);
SetIndexBuffer(2,Buffer3);
IndicatorShortName(IndicatorName+" buffers ("+(string)BufferNumber1+","+(string)BufferNumber2+","+(string)BufferNumber3+")");
return(0);
}
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
static datetime lastChecked=0;
static bool checked =false;
if (!checked&&lastChecked!=Time[0])
{
ResetLastError(); double dummy = iCustom(NULL,0,IndicatorName,0,0); checked = (GetLastError()==0); lastChecked=Time[0];
}
if (!checked) { Comment("Problem loading "+IndicatorName+"\nCheck the indicator name"); return(0); }
//
//
//
//
//
for(int i=limit; i>=0; i--)
{
if (BufferNumber1>=0) Buffer1[i] = iCustom(NULL,0,IndicatorName,BufferNumber1,i);
if (BufferNumber2>=0) Buffer2[i] = iCustom(NULL,0,IndicatorName,BufferNumber2,i);
if (BufferNumber3>=0) Buffer3[i] = iCustom(NULL,0,IndicatorName,BufferNumber3,i);
}
return(0);
A time filter that will for any case of time limitation. It is an overloaded function (to call it using just hours, hours and minutes or hours, minutes and seconds). It will not work with old builds of metatrader. Works with new metatrader 4 and metatrader 5. Handles all the time combination cases within a day with no problem
Seeing how easy is to overload a function, look at the way how IndicatorSetInteger(), IndicatorSetDouble() and IndicatorSetString (and all sort of similar cases are made) and try to guess why was it necessary to make 3 different calling ways when it could simply be overloaded
Hi,
I tried it in MT5 but fails..
after add the time code , the experts compile like an indicator... I don't know what happened