vovan-gogan: Folks, help: I have a condition in my EA which is to open a Buy position only if the low of the previous candlestick is below all the lows of the previous 40 candlesticks. The question: how to implement this enumeration of previous candlestick's lows and find out if the low of the previous candlestick was below the low of the previous candlestick? I thank you in advance.
int TotalBars = 40; // Общее количество свечей по которым нужно осуществлять переборdouble max=0.0;
double min=100.0;
for(int n=0; n<TotalBars; n++)
{
if(High[n]>max) max=High[n];
if(Low[n]<min) min=Low[n];
}
MessageBox("Maximum="+max+" Minimum="+min);
We remove the signal line of the MACD indicator, all indicators are applied to the Close price indicator.
Buy entry signal: EMA(3) crosses EMA(18) from bottom to top, wait for the MACD to show positive side. If RSI(14) is above the 50 level, then buy. Stop-loss is set at the last local minimum. Exit the trade by reversing the EMA crossover, or use your own approach.
Signal to sell: Reverse situation: Crossing of EMA(3) EMA(18) downwards, wait for MACD to be negative. If RSI(14) is below 50, then buy. Stop-loss is set to the last high.
When compiling the code it says that a bracket is missing. After a long search I seemed to have found where it should be, but after fixing the error I got another 20-30 new bugs. Please, advise me where i missed it. ))) The code is in the attached file.
Read: https://book.mql4.com/ru/variables/arrays . It turns out that I can organize a two-dimensional array for three pairs: double Mas_d[3][2] = {1, 0, 2, 0, 3,0};
while keeping in mind that:
the value of Mas_d[1][1] corresponds to e.g. the AUDCAD pair, and Mas_d[1][2] is the value of this pair;
the value of Mas_d[2][1] corresponds for example to AUDCHF pair and Mas_d[2][2] is the value of this pair;
value of Mas_d[3][1] corresponds for example to AUDJPY, and Mas_d[3][2] is the value of this pair,
the array elements retain their values between ticks. And then I will be able to change values of array elements according to the criterion I need. Did I understand correctly what you mean? :)
Yes. The approach may not be the best, but everyone chooses it himself. And then, if necessary, modernize and optimize it! :))
I am in the process of modernising my approach. It's not convenient in some cases! :D
Yes. The approach may not be the best, but everyone chooses it for themselves. And then, if necessary, modernize and optimize it! :))
I am in the process of modernizing my approach. It's not convenient in some cases! :D
I'm a beginner and I tried to write a trial Expert Advisor, but I got a mistake when compiling it " \end_of_program' - ending bracket '}' expected C:\Program Files\ForexClub MT4\experts\trsi01.mq4 (30, 3)" I know I wrote it wrong, could you please tell me where I made mistakes?
I am a beginner and I tried to write a trial Expert Advisor, but when I compile it I get the error "\end_of_program' - ending bracket '}' expected C:\Program Files\ForexClub MT4\experts\trsi01.mq4 (30, 3)" I know I wrote it wrong, could you please tell me where the error is?
Thanks, I'll keep it in mind :). Can you please advise which is the minimum stop loss for a specific currency pair? For example EURAUD - you cannot place a stop loss less than 100 pips, and for the others?
first_may: Thanks, will keep it in mind :). Can you please tell me, which minimum stop-loss has a specific currency pair? For example EURAUD - you can't set stop loss less than 100 pips for EURAUD, and for the others?
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.
Folks, help: I have a condition in my EA which is to open a Buy position only if the low of the previous candlestick is below all the lows of the previous 40 candlesticks. The question: how to implement this enumeration of previous candlestick's lows and find out if the low of the previous candlestick was below the low of the previous candlestick? I thank you in advance.
Ai thank you!)
Mmm... Here's the problem... The data should be updated with every new tick and only for the last 30 bars... I keep the data for some reason
Help me find an error!
I am writing an EA based on "Black MACD" strategy:
Currency pair: any
Time frame: 15 and more.
Indicators: EMA(3) EMA(18), RSI(14), MACD(12,26,9)
We remove the signal line of the MACD indicator, all indicators are applied to the Close price indicator.
Buy entry signal: EMA(3) crosses EMA(18) from bottom to top, wait for the MACD to show positive side. If RSI(14) is above the 50 level, then buy. Stop-loss is set at the last local minimum. Exit the trade by reversing the EMA crossover, or use your own approach.
Signal to sell: Reverse situation: Crossing of EMA(3) EMA(18) downwards, wait for MACD to be negative. If RSI(14) is below 50, then buy. Stop-loss is set to the last high.
When compiling the code it says that a bracket is missing. After a long search I seemed to have found where it should be, but after fixing the error I got another 20-30 new bugs. Please, advise me where i missed it. ))) The code is in the attached file.
BlackvMACD.mq4 (5.21 KB) delete
Read: https://book.mql4.com/ru/variables/arrays . It turns out that I can organize a two-dimensional array for three pairs: double Mas_d[3][2] = {1, 0, 2, 0, 3,0};
while keeping in mind that:
the value of Mas_d[1][1] corresponds to e.g. the AUDCAD pair, and Mas_d[1][2] is the value of this pair;
the value of Mas_d[2][1] corresponds for example to AUDCHF pair and Mas_d[2][2] is the value of this pair;
value of Mas_d[3][1] corresponds for example to AUDJPY, and Mas_d[3][2] is the value of this pair,
the array elements retain their values between ticks. And then I will be able to change values of array elements according to the criterion I need. Did I understand correctly what you mean? :)
Yes. The approach may not be the best, but everyone chooses it himself. And then, if necessary, modernize and optimize it! :))
I am in the process of modernising my approach. It's not convenient in some cases! :D
Yes. The approach may not be the best, but everyone chooses it for themselves. And then, if necessary, modernize and optimize it! :))
I am in the process of modernizing my approach. It's not convenient in some cases! :D
I'm a beginner and I tried to write a trial Expert Advisor, but I got a mistake when compiling it " \end_of_program' - ending bracket '}' expected C:\Program Files\ForexClub MT4\experts\trsi01.mq4 (30, 3)" I know I wrote it wrong, could you please tell me where I made mistakes?
//+------------------------------------------------------------------+
//| trsi01.mq4 |
//| Copyright © 2011, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp.
#property link "http://www.metaquotes.net"
double StopLoss=30;
double TakeProfit=100;
double Lots=0.1;
return(0);
int start()
{
if(iRSI(NULL,0,8,PRICE_CLOSE,0)<30)
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-StopLoss*Point,Ask+TakeProfit*Point)
{
if(iRSI(NULL,0,8,PRICE_CLOSE,0)>70)
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+StopLoss*Point,Bid-TakeProfit*Point);
{
return(0);
{
I am a beginner and I tried to write a trial Expert Advisor, but when I compile it I get the error "\end_of_program' - ending bracket '}' expected C:\Program Files\ForexClub MT4\experts\trsi01.mq4 (30, 3)" I know I wrote it wrong, could you please tell me where the error is?
//+------------------------------------------------------------------+
//| trsi01.mq4 |
//| Copyright © 2011, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp.
#property link "http://www.metaquotes.net"
double StopLoss=30;
double TakeProfit=100;
double Lots=0.1;
return(0);
int start()
{
if(iRSI(NULL,0,8,PRICE_CLOSE,0)<30)
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-StopLoss*Point,Ask+TakeProfit*Point)
{
if(iRSI(NULL,0,8,PRICE_CLOSE,0)>70)
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+StopLoss*Point,Bid-TakeProfit*Point);
{
return(0);
{
The error is that you haven't read the manual from cover to cover. If you opened it at all.
But you obviously missed this section: Conditional operator if - else.
You'd be better off reading the book from cover to cover.
Thanks, will keep it in mind :). Can you please tell me, which minimum stop-loss has a specific currency pair? For example EURAUD - you can't set stop loss less than 100 pips for EURAUD, and for the others?
https://book.mql4.com/ru/appendix/marketinfo
How do you form a binary number, e.g. of 7 digits? And how can it then (for convenience) be converted to a decimal number?