Questions from Beginners MQL4 MT4 MetaTrader 4 - page 4

 
strongflex:
How do I make the EA remember the price that was at the execution of the condition that at 9-20 RSI crossed the level and 20 minutes later there is a price check. And I need to compare the price 20 minutes ago and now

then count in seconds, 20 minutes * 60 seconds = 1200

Compare the current RSI and the one that was 1200 seconds before...

 
Taras Slobodyanik:

then count in seconds, 20 minutes * 60 seconds = 1200

compare current RSI with the one 1200 seconds before...

if (Hour()==9&& (Minute() ==20) && (RSI>70))
Price2==Bid;
{
if (
Hour()==9&& (Minute() ==40) && (Bid<Price2))

{

ticket=OrderSend
(Symbol(),OP_SELL,Lts,Bid,SP,0,0,NULL,Magic,0,Blue);
return(
0);
}

}

Can you do it like this?)))

 
strongflex:

if (Hour()==9&& (Minute() ==20) && (RSI>70))
Price2==Bid;
{
if (
Hour()==9&& (Minute() ==40) && (Bid<Price2))

{

ticket=OrderSend
(Symbol(),OP_SELL,Lts,Bid,SP,0,0,NULL,Magic,0,Blue);
return(
0);
}

}

Can you do it like this?)))

You need to remember the time for the countdown and check it to make sure 1200 seconds have elapsed. Track the time with theTimeCurrent function.

andPrice2 can be watched on history, in the past, why remember it?

if (TimeCurrent()-LastTime>=1200)
   {
   LastTime = TimeCurrent();
  
   //проверяем текущий РСИ и тот что был 1200 секунд назад
  
   }
 
Hi! It's written everywhere that an indicator written in mql4 cannot have more than 8 buffers. Ok, but in the comment of a commercial indicator for mt4 (in the mql5.com marketplace), the author of the indicator says, that when using iCustom function, use buffers #9 and #10 ... I read about some additional buffers elsewhere ... Help me to understand how many buffers an indicator may have with current mql4... and how to set buffer numbers (may be it's the point) ?
 
Taras Slobodyanik:
...when modifying incorrect stoploss - the log should have an error "disabled stoploss".
I had to modify it, though I had an idea to put a trawl on stop, it is a separate function and works fine, but with profit it sucks.
 
Vitalie Postolache:

Why be so complicated when the ticket is there?

Ticket=OrderSend(NULL,OP_BUY,Lot,Ask,slippage,0,0,NULL,magic,0,Blue);
//не забываем проверить код ошибки
if(Ticket<0Print("Ой, ошибочка: "_LastError);
TP=NormalizeDouble(Bid+TakeProfit*Point,Digits);

bool modify=OrderModify(Ticket,OrderOpenPrice(),OrderStopLoss(),TP,0);

//не забываем проверить код ошибки

if(!modify) Print("OOPS! Modify error: "_LastError);

Shit, maybe it is. I'd forgotten about the stop in the function. I'll try tomorrow with a 0 stop.
 

Everything works now:

{
   Ticket=OrderSend(NULL,OP_SELL,Lot,Bid,slippage,0,0,NULL,magic,0,Red);
   if(OrdersTotal()!=0)
   {
    for (int i = 0; i < OrdersTotal(); i++)
     {
      if(OrderSelect(i,SELECT_BY_POS)==true)
      {
      TP=NormalizeDouble(Ask-TakeProfit*Point,Digits);
      bool modify=OrderModify(OrderTicket(),OrderOpenPrice(),0,TP,0,0);
      }
     }
      return;
   }

The problem was the lack of SL, even if the trawl stands afterwards.Thank you all.

 
I have not found a theme suitable for a problem. Therefore I will ask a question here. Today, the terminal is off. It has not been for a long time, this has happened more often before. Now I adjust the owl, two weeks I drive the computer, I turn off only on weekends, and here again, came from work, and it works, but not in the network, the last order of 3 pm. The Internet is not cut off, the computer is working, the terminal is on. Here is how to put it on a hosting, if it shuts down.GC Trader 4 build 1010-what could be a problem, or it is only me and the hoster will not have such problems?

 

Vladymyr Glushko

Forum on trading, automated trading systems and testing trading strategies

MetaEditor build 1470

Vladymyr Glushko, 2016.11.12 04:24

Good day to you.

I am a newbie in trading, so there are a lot of questions, including software questions, in my case this is MT4.

What is the deal , is it possible to make the spread of the currency pair , for example, displayed on the chart window as a number , and in the same way the indicator ATR ?

So, no graphs, just numbers

Example

ATR (14) - 33

Spred 27

I think it would be convenient to use this view of the market situation, it's more convenient and quick to estimate from the averages.

The second point is moving stop based on ATR.

Is it possible to make it automatic?

If you sit in a pose, thanks to the calculator and good eyesight, you can calculate and set a stop manually - no problem.

And if you make this process automatic, it is a good solution for traders, even if they have drawbacks, but in a good trend the trailing stop will reduce the risk of a wrong stop.

Thanks in advance.


 
Ilya Melamed:
Hi! It is written everywhere that an indicator written in mql4 cannot have more than 8 buffers. Ok, but in the comment of a commercial indicator for mt4 (from mql5.com marketplace), the indicator author says, that when using iCustom function, use buffers #9 and #10 ... I read about some additional buffers elsewhere ... Help me to understand how many buffers an indicator may have with current mql4... How to set the numbers of buffers (maybe it's in this case) ?

The information about 8 buffers is outdated

In the new MQL4 you can set up to 512 buffers.

In order to understand it, see indicators source code in MQL4\Indicators\Examples folder. And read documentation

Пользовательские индикаторы - Справочник MQL4
Пользовательские индикаторы - Справочник MQL4
  • docs.mql4.com
Пользовательские индикаторы - Справочник MQL4
Reason: