Hi all! I have an indicator - written in mql5 which I would like to use to create an EA. When I create an EA, I can't find the buffers I need, it feels like I don't have them at all. I have to do it this way:
{
//--- indicator buffers mapping SetIndexBuffer(2,BuyBuffer,INDICATOR_DATA);
ResetLastError();
double handle3 = 0;
double handle4 = 0;
double UP = 0;
double DW = 0;
for (int i=1; i<11; i++)
{
UP = iCustom(NULL,0,"StepMA_NRTR",Length,Kv,StepSize,Percentage,Switch,Shift,2,i);
DW = iCustom(NULL,0,"StepMA_NRTR",Length,Kv,StepSize,Percentage,Switch,Shift,3,i);
if (handle3==0)
if (UP != EMPTY_VALUE)
handle3=1;
if (handle4==0)
if (UP != EMPTY_VALUE)
handle4=1;
if (handle3>0 && handle4)
break;
}
Comment(DoubleToString(handle3,Digits())+"\n"+DoubleToString(handle3,Digits()));
return(INIT_SUCCEEDED);
}
No matter how I change or add an iCustom line - I keep getting the same thing in the log:
Hi all! I have an indicator - written in mql5 which I would like to use to create an EA. When I create an EA, I can't find the buffers I need, it feels like I don't have them at all. I have to do it this way:
No matter how I change or add an iCustom line - I keep getting the same thing in the log:
Turns out I need a stop loss - (couldn't figure out why it closed immediately) added a stop loss
Thanks a lot !!!
You did a good job, but I'm interested in a completely different algorithm for the EA. I would like to use a simple Martingale (sieve) with these customizable parameters :
input group "======== МАРТИН ========";
inputint MMType = 1; // 1 - вкл. , 2 - выкл.
inputdouble Multiplikator = 1.667; // множитель следующего лота
inputdouble Step = 150.0; // Расстояние между ордерами
input group "==== МАНИ МЕНЕДЖМЕНТ ====;
inputbool LotConst = true; // фиксированный - true, или от баланса - falseinput group "-: фиксированный лот :--";
inputdouble Lot = 0.01; // первый фиксированный лот, если МАРТИН включен
input group "---: лот от баланса :---";
inputdouble RiskPercent = 30.0; // первый лот в процентах от баланса, если МАРТИН включен
input group "== ПРИБЫЛЬ В ПУНКТАХ ===";
inputdouble TakeProfit = 56.0; // параметры тейкпрофита в пунктах
input group "========= Шаг ==========";
inputdouble Step = 150.0; // шаг в пунктах между ордерами
input group "===== ОГРАНИЧИТЕЛЬ =====";
inputint MaxTrades = 15; // Максимальное количество ордеров одного направления
input group "=== ПРОСКАЛЬЗОВАНИЕ ====";
inputdouble Slippage = 5.0; // Допустимое проскальзывание на новостях в пунктах
input group "== МАГИЧЕСКИЙ НОМЕР ===";
inputint Magic = 1111111 ; // Идентификатор ордера (Магик №)
, but add to it the indicator I put in - above. And use it as a trigger (false - work only in SHORT and true - work only in LONG).
I chose this indicator - only because it works like MovingAverages, but it has some smoothing filters and price direction change points, which can be used as a trigger for the EA to work only on trend using profit settings from the menu.
And as soon as the take profit is closed, we open the next order in the same direction (in the trend), until the trend is over and our trigger is switched over. If an order does appear out of trend (at the moment when the trend changes from one state to another), we should use Martins with settings from the menu for it.
If you want to help write such an EA, I would be very grateful.
Now on the subject:
I understand that in my code of the indicator itself - are not indicator buffers, but arrays of buffers and you - in the Expert Advisor brought them into the indicator.
I understood that in my codes of the indicator itself - not indicator buffers are located, but arrays of buffers and you - in the Expert Advisor brought them to indicator.
Please advise if I understand correctly?
I am self-taught and i am not able to explain it, i have just selected the functions i need.
I basically copy the codes from Vladimir Karputov, thank him very much! - If you have any questions he will tell you.
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.
Please tell me which class to inherit your class from in order to use all the methods of these
to use all the methods of these classes inside of your class, without creating objects inside of your class?
Inheritance means creating a class.
Hi all!
I have an indicator - written in mql5 which I would like to use to create an EA.
When I create an EA, I can't find the buffers I need, it feels like I don't have them at all.
I have to do it this way:
{ //--- indicator buffers mapping SetIndexBuffer(2,BuyBuffer,INDICATOR_DATA); ResetLastError(); double handle3 = 0; double handle4 = 0; double UP = 0; double DW = 0; for (int i=1; i<11; i++) { UP = iCustom(NULL,0,"StepMA_NRTR",Length,Kv,StepSize,Percentage,Switch,Shift,2,i); DW = iCustom(NULL,0,"StepMA_NRTR",Length,Kv,StepSize,Percentage,Switch,Shift,3,i); if (handle3==0) if (UP != EMPTY_VALUE) handle3=1; if (handle4==0) if (UP != EMPTY_VALUE) handle4=1; if (handle3>0 && handle4) break; } Comment(DoubleToString(handle3,Digits())+"\n"+DoubleToString(handle3,Digits())); return(INIT_SUCCEEDED); }No matter how I change or add an iCustom line - I keep getting the same thing in the log:
2021.06.26 17:59:42.251 Proba (EURUSD,M15) 1.00000
And the comment: 1.00000 and 1.00000 again.
Help me understand - is it suitable for creating an EA, or do I need to refine it, or maybe I'm doing something wrong?In MT5 it is used differently. Take a look at the example in the help.
iCustom
Returns the handle of the specified custom indicator.
https://www.mql5.com/ru/docs/indicators/icustom
In MT5 it is used differently. Take a look at the example in the help.
iCustom
Returns the handle of the specified custom indicator.
https://www.mql5.com/ru/docs/indicators/icustom
I am just starting to program and ask you to be lenient with me.
I'm beginning to suspect that this requires an additional function
Please explain.... where .... and how....?
Hi all!
I have an indicator - written in mql5 which I would like to use to create an EA.
When I create an EA, I can't find the buffers I need, it feels like I don't have them at all.
I have to do it this way:
No matter how I change or add an iCustom line - I keep getting the same thing in the log:
2021.06.26 17:59:42.251 Proba (EURUSD,M15) 1.00000
And the comment: 1.00000 and 1.00000 again.
Help me understand - is it suitable for creating an EA, or do I need to refine it, or maybe I'm doing something wrong?Code:
Result:
Hi all!
I have an indicator - written in mql5 - that I would like to use to create an EA.
Here I made it - it seems to work! (where yellow is for buffers)
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
I also need a stop loss(I couldn't figure out why it closed immediately).
I'm beginning to suspect that this requires an extra function
That's right. You connect the indicator in OnInit, set parameters there and get its handle. And then use the CopyBuffer.
https://www.mql5.com/ru/docs/series/copybuffer
I made this - it seems to be working! (where yellow is the buffers)
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Turns out I need a stop loss - (couldn't figure out why it closed immediately) added a stop loss
Thanks a lot !!!
You did a good job, but I'm interested in a completely different algorithm for the EA. I would like to use a simple Martingale (sieve) with these customizable parameters :
, but add to it the indicator I put in - above. And use it as a trigger (false - work only in SHORT and true - work only in LONG).
I chose this indicator - only because it works like MovingAverages, but it has some smoothing filters and price direction change points, which can be used as a trigger for the EA to work only on trend using profit settings from the menu.
And as soon as the take profit is closed, we open the next order in the same direction (in the trend), until the trend is over and our trigger is switched over. If an order does appear out of trend (at the moment when the trend changes from one state to another), we should use Martins with settings from the menu for it.
If you want to help write such an EA, I would be very grateful.
Now for the subject:
I am self-taught and i am not able to explain it, i have just selected the functions i need.
I basically copy the codes from Vladimir Karputov, thank him very much! - If you have any questions he will tell you.
I understand you need an indicator to filter !
You need to run your Expert Advisor through this filter