Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 116

 
Hello, could you tell me how to indicate a real timeframe in a condition? Do you mean a variable or maybe there is a special designation?
 
skyjet:
Hello, could you tell me how to indicate a real timeframe in a condition? Do you mean a variable or maybe there is a special designation?

MQL4 Reference - Operations with Charts-Period
MQL4 Reference-Standard Constants-Chart Periods
 
artmedia70:

Shit... what are you smoking? Where do you get your cigarettes from? Owl went to the shop and bought some... And then some funk came along and ruined everything.

Bummer...



What a double-edged question) Options for interpretation are as follows:

1. Supposed to find out if you smoke at all.

2. What you smoke.

3. Where and on what plantations it grows. So to speak, I want one too. ))))))

I could do some more, but I don't think so. If you're a smoker, you'd better keep a low profile, or you're going to get smoked. They'll find you...They will find it and make it public...

 
 
pako:

put the position data into an array
Why read the data into an array when you can get the same data from the environment? Why a crutch?
 

Guys, I'm coming back to you for knowledge.

I am trying to solve the following problem - three consecutive bullish bars, MACD bar on the first bar is bigger than on the second, the first bullish bar is bigger than the MA - we open a buy trade.

The trade itself opens, but there is no MACD signal. It doesn't work on the test runs and the MA either. Help!!!!!!

Here is my awkward code, where did I mess up?

void CheckForOpen()
{
   int ticket, STOPLEVEL;
   double Price, SL, TP; 
   STOPLEVEL=MarketInfo(Symbol(),MODE_STOPLEVEL);
   
    
   double MA_1 = iMA(Symbol(),0,MA_Period,MA_Shift,MA_Method,PRICE_CLOSE,1);
   double MaCD_1 = iMACD(Symbol(),0,FastEMA,SlowEMA,SignalSMA,0,MODE_MAIN,1); 
   double MaCD_2 = iMACD(Symbol(),0,FastEMA,SlowEMA,SignalSMA,0,MODE_MAIN,2); 

   if(Volume[0]>1) return;
   
//---- buy conditions
   if (Open[3]<Close[3] && Open[2]<Close[2] && Open[1]<Close[1])
   if (Low[1]>MA_1)
   if (MaCD_1>0 && MaCD_2>0 && MaCD_1>MaCD_2)// покупка
   
     
   {
     Price = NormalizeDouble(Ask, Digits); // округляем до нужного нам числа цифр после запятой
     if(StopLoss >= STOPLEVEL)
      {
       SL = iLow(Symbol(),0,3); // вычисляем стоплос
       SL = NormalizeDouble(SL, Digits); // округляем до нужного нам числа цифр после запятой
      }
       else SL = 0;
     if(TakeProfit > 0)
      {
       TP = Price + TakeProfit*Point; // вычисляем тейкпрофит
       TP = NormalizeDouble(TP, Digits); // округляем до нужного нам числа цифр после запятой
      }
       else TP = 0;
      {
      ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,SL,TP,"Pattern_1",Magic,0,Blue);
      return;
      } 
   }
 }
 
Adding a screenshot
 
alexey1979621:

Guys, I'm coming back to you for knowledge.

I am trying to solve the following problem - three consecutive bullish bars, the MACD bar on the first bar is bigger than on the second, the first bullish bar is bigger than the MA - we open a buy trade.

The trade itself opens, but there is no MACD signal. On the test runs and the MA doesn't work either. Help!!!!!!

Here is my crummy code, where did I mess up?


Nowhere in this function; most likely a fault in the conditions of the checkforopen function call.
 
alexey1979621:

Guys, I'm coming back to you for knowledge.

I am trying to solve the following problem - three consecutive bullish bars, the MACD bar on the first bar is bigger than on the second, the first bullish bar is bigger than the MA - we open a buy trade.

The trade itself opens, but there is no MACD signal. On the test runs and the MA doesn't work either. Help!!!!!!

Here is my crummy code, where did I mess up?

Normal MACD Sample entry conditions in MT4 itself. Why should you make up your own stuff? Take it, use it, add what is missing! But don't make up something that has been tested hundreds of times and works well in any market!
Reason: