[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 480

 

Help make sense of this Expert Advisor

based on alligator indicator
signal to buy when the green line crosses the blue and red from bottom to top opens a position on the Buy
signal to sell when the green line crosses the red and blue from top to bottom opens a position on the Sell
position closed when StopLoss and TakeProfit


no errors during compilation, but there are errors during testing in the strategy tester
the first error waiting for the string order did not open opened deleted code containing the string string from compiled no errors ran in the strategy tester
works, but opens only Sell position to Buy not want
Could you please look and sign off what is wrong in the code

Files:
all_2.mq4  2 kb
 
novicek:

Help me deal with this EA

alligator indicator
a buy signal when the green line crosses the blue one and the red one crosses from bottom to top, opens a Buy position
a sell signal when the green line crosses the red one and the blue one from the top downwards opens a Sell position
positions are closed when StopLoss and TakeProfit are reached


no errors during compilation, but when tested in the strategy tester there are errors
the first error waiting for the string order did not open deleted code containing string from compiled no errors run in the strategy tester
works, but opens only positions on Sell on Buy does not want
Couldyou please look and write what is wrong in the code


look at the opening lines:

OrderSend(Symbol(),OP_BUY,Lot,Ask,Slippage,magic,Ask , StopLoss * Point, Ask , TakeProfit * Point);
            
OrderSend(Symbol(),OP_SELL,Lot,Bid,Slippage,magic,Bid , StopLoss * Point, Bid , TakeProfit * Point);

Now look at the specification of the OrderSend function itself (see description here https://docs.mql4.com/ru/trading/OrderSend)

int OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE) 

and check if the parameters are still there

 
novicek:

Let there be no doubt about my literacy
Not putting punctuation marks is my binge, that's all.


When you put your "don't punctuate" binge into practice, don't be surprised to find your questioning posts frequently ignored.

People also have a habit of respecting themselves.
They also have a habit of respecting their own language.

 
Thanks, but I couldn't find a solution there, I need to apply bollinger to rsi, I can do it manually, but how do I do it programmatically?
 
ZZZEROXXX:
Thank you, but I didn't find a solution there, I need to impose bollinger on rsi, you can do it manually, but how to do it programmatically?

Bollinger is MA pushed up and down on StdDev. You can do it in two ways.

1. If you are happy with the integer deviation change of Deviat, you can use the iBandsOnArray function

2. If you also need to count decimal fractions of Deviat, you will have to use the iMAOnArray and iStdOnArray functions

It looks as follows in the code:

#property indicator_separate_window
#property indicator_buffers 4
#property indicator_minimum 0
#property indicator_maximum 100

#property indicator_color1 SkyBlue
#property indicator_color2 LimeGreen
#property indicator_color3 LimeGreen
#property indicator_color4 LimeGreen
#property indicator_style2 STYLE_DOT

extern int rsiPeriod=14;
extern int rsiPrice=PRICE_CLOSE;
extern int bbPeriod=20;
extern int bbShift=0;
int bbMethod=MODE_SMA;
extern double bbDeviat=2;

double rsi[], ma[], up[], dn[], stdev[];
//------------------------------------------------------------------    init
int init()
{
  int i=0;
  SetIndexBuffer(i, rsi); SetIndexStyle(i, DRAW_LINE); SetIndexLabel(i, "RSI"); i++;
  SetIndexBuffer(i, ma); SetIndexStyle(i, DRAW_LINE); SetIndexLabel(i, "MA"); i++;
  SetIndexBuffer(i, up); SetIndexStyle(i, DRAW_LINE); SetIndexLabel(i, "UP"); i++;
  SetIndexBuffer(i, dn); SetIndexStyle(i, DRAW_LINE); SetIndexLabel(i, "DN"); i++;
  IndicatorBuffers(5);
  SetIndexBuffer(i, stdev); SetIndexStyle(i, DRAW_NONE); // добавочный буфер расчета
  return(0);
}
//------------------------------------------------------------------    start
int start()
{
  int count=IndicatorCounted(); if (count<0) return; // если ошибка расчета
  int lim=Bars-count; if (lim>1) lim=Bars-1; // если нерасчитано более 1 бара, то полный пересчет
  // 1. получаем массив RSI
  for (int i=lim; i>=0; i--) rsi[i]=iRSI(Symbol(), Period(), rsiPeriod, rsiPrice, i);
  // 2. строим на основе RSI - МА (средняя линия болинджера), StdDev и Верхнюю и Нижнюю границу Боллинджера
  for (i=lim; i>=0; i--) 
  {
    ma[i]=iMAOnArray(rsi, 0, bbPeriod, bbShift, bbMethod, i); // средняя линия
    stdev[i]=iStdDevOnArray(rsi, 0, bbPeriod, bbShift, bbMethod, i); // отклонение
    up[i]=ma[i]+bbDeviat*stdev[i]; // верхняя граница
    dn[i]=ma[i]-bbDeviat*stdev[i]; // нижняя граница
  }
  return(0);
}
Files:
_bbonrsi.mq4  3 kb
 
abolk:

When you implement your "don't punctuate" bias, don't be surprised that your questioning posts will be frequently ignored.
People also have a tendency to respect themselves.
They also have a habit of respecting their own language.

That's right. It hurts the eye and makes you want to turn away.
And doubts arise anyway - "about my literacy (education)".
 
sergeev:

In the code, it looks like this:

Thank you! Just what you need.
 
abolk:


When you implement your "don't punctuate" bias, don't be surprised that your questioning posts will be frequently ignored.

People also have a tendency to respect themselves.
They also have a habit of respecting their own language.

I, for example, still don't know where to put them, I only know that there should be a dot at the end - I know that for sure. Russian is the hardest language. But it has the advantage that you can express itself so that any other language would be the envy of especially the swear language, it's short and simple, I sometimes use it when someone is having difficulty understanding you swear and everyone immediately understands everything and no one comes up to you with stupid questions during the day.
 
Dear, could you please advise how to call the information Open[1] and Close[1] from several TFs into the Expert Advisor?
 
A bzik and a B in Russian are different things. I have a solid B, I'm good enough.