Hi all. Please help, I can't figure out the situation.
In my code I need buf0 to be drawn on screen, and buf1 is not drawn, but counted for further array processing and output to another buffer (for example in buf2). I hide buf1 in a string:
Hi all. Please help, I can't figure out the situation.
In my code I need buf0 to be drawn on screen, and buf1 is not drawn, but counted for further array processing and output to another buffer (for example inbuf2). I hide buf1 in a string:
SetIndexBuffer(0,Buf0);
SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(1,Buf1);
SetIndexStyle (1,DRAW_NONE); //I want to hide this line
But when I set the indicator I get an offset due to difference in calculation...
QUESTION: is there any way to remove this difference so that buf0 is drawn normally?
Read about INDICATOR_DATA and INDICATOR_CALCULATIONS
And before that read #property indicator_buffers and IndicatorBuffers(10); 10 is from my indicator, I didn't delete it to show not limited number of buffers as in ME 509 build.
I often press F1, but things are not always clear to a weak programmer. Example - ArraySetAsSeries -> Sets AS_SERIES flag to specified dynamic array object, array elements will be indexed as in timeseries.
Parameters
array[]
[in][out] Numeric array to set.
flag
[in] The indexing direction of the array.
Returned value
Returns true if successful, otherwise false.
But what gives and how it will be for(i=0; i<InpBandsPeriod; i++) and for(i=InpBandsPeriod; i<0; i--) . Will true and false be reflected in the loops. This was not present in build 5xx. Maybe it's possible to do without ArraySetAsSeries, but then what would be the default.Or maybe you may not.
//| Параметры: |//| sy - наименование инструмента ("" - любой символ, |//| NULL - текущий символ) |//| op - операция (-1 - любая позиция) |//| mn - MagicNumber (-1 - любой магик) |//| ot - время открытия ( 0 - любое время открытия) |//+----------------------------------------------------------------------------+bool ExistPositions(string sy="", int op=-1, int mn=-1, datetime ot=0) {
int i, k=OrdersTotal();
if (sy=="0") sy=Symbol();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==sy || sy=="") {
if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
if (op<0 || OrderType()==op) {
if (mn<0 || OrderMagicNumber()==mn) {
if (ot<=OrderOpenTime()) return(True);
}
}
}
}
}
}
return(False);
}
look at this ot - opening time ( 0 - any opening time), and you?
so it should check whether there are no open positions at all with such a magik no matter what time of opening..... simple limitation on the magik....toast
if(ExistPositions(NULL,-1,44444,-1)==false)//if there are no open positions with this magic number then check......
.... or maybe I do not understand.... I have -1 because I do not care when a position opened ..... anyway it will open only on a new bar and when the old one is closed because the conditions specify that the position can open only if there are no open positions with this magic number
to make it even simpler: open position and wait until it closes.... when it closes then opens again and certainly should not open on every bar a position with this magician.... it is again checked in the condition to see if there are no open positions with this magician.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
And read the documentation? Step on an incomprehensible expression and press the magic F1 key or read on the website.
https://docs.mql4.com/ru/array/arraysetasseries
https://docs.mql4.com/ru/basis/function/events#oncalculate
Hi all. Please help, I can't figure out the situation.
In my code I need buf0 to be drawn on screen, and buf1 is not drawn, but counted for further array processing and output to another buffer (for example in buf2). I hide buf1 in a string:
SetIndexBuffer(0,Buf0);
SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(1,Buf1);
SetIndexStyle (1,DRAW_NONE); //I want to hide this line
But when I set the indicator I get an offset due to difference in calculation...
QUESTION: is there any way to remove this difference so that buf0 is drawn normally?Hi all. Please help, I can't figure out the situation.
In my code I need buf0 to be drawn on screen, and buf1 is not drawn, but counted for further array processing and output to another buffer (for example inbuf2). I hide buf1 in a string:
SetIndexBuffer(0,Buf0);
SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(1,Buf1);
SetIndexStyle (1,DRAW_NONE); //I want to hide this line
But when I set the indicator I get an offset due to difference in calculation...
QUESTION: is there any way to remove this difference so that buf0 is drawn normally?Read about INDICATOR_DATA and INDICATOR_CALCULATIONS
And before that read #property indicator_buffers and IndicatorBuffers(10); 10 is from my indicator, I didn't delete it to show not limited number of buffers as in ME 509 build.
Parameters
array[]
[in][out] Numeric array to set.
flag
[in] The indexing direction of the array.
Returned value
Returns true if successful, otherwise false.
But what gives and how it will be for(i=0; i<InpBandsPeriod; i++) and for(i=InpBandsPeriod; i<0; i--) . Will true and false be reflected in the loops. This was not present in build 5xx. Maybe it's possible to do without ArraySetAsSeries, but then what would be the default.Or maybe you may not.
thanks to AlexeyVik, got it sorted out...
Who can tell me how long the old mql4 language from the 509 build will last? is it necessary to learn the language in a hurry from the new build?
kim's function is not working...
the position should open if there are no more positions with the wizard..... but they open on every new bar with me......
kim's function is not working...
the position should open if there are no more positions with the wizard..... but they open on every new bar with me......
look at this ot - open time( 0 - any open time), what about you?
look at this ot - open time ( 0 - any open time), what about you?
And why
if there is no open, open
look at this ot - opening time ( 0 - any opening time), and you?
so it should check whether there are no open positions at all with such a magik no matter what time of opening..... simple limitation on the magik....toast
if(ExistPositions(NULL,-1,44444,-1)==false)//if there are no open positions with this magic number then check......
.... or maybe I do not understand.... I have -1 because I do not care when a position opened ..... anyway it will open only on a new bar and when the old one is closed because the conditions specify that the position can open only if there are no open positions with this magic number
to make it even simpler: open position and wait until it closes.... when it closes then opens again and certainly should not open on every bar a position with this magician.... it is again checked in the condition to see if there are no open positions with this magician.
if(!ExistPositions(Symbol(),-1,44444))OpenPosition(Symbol(),OP_BUY,0.1,Ask-sl*Point,Ask+tp*Point,44444)
poprobuj