Questions from Beginners MQL4 MT4 MetaTrader 4 - page 127

 
nsd63 Is it possible to do with this indicator

Need MQ4 source code

 

Citizens, please advise how to express the logic in the code!

I have on the chart MA.... and I need it to trigger SELL, if the candle crossed the MA upwards downwards and BUY, if the candle crossed from below upwards....

Thanks in advance!

 
sviter-pro:

Citizens, please advise how to express the logic in the code!

I have on the chart MA.... and I need it to trigger SELL, if the candle crossed the MA upwards downwards and BUY, if the candle crossed from below upwards....

Thanks in advance!

there is an Expert Advisor in the terminal, Moving Average.mq4 - it's already done there. It works perfectly

 

Greetings.

Can you please tell me how to "slip" into MT4 tester a created history file with a timeframe that is not in the tester (or other options)?

The point is that there is an Expert Advisor, from here http://tradelikeapro.ru/grafiki-renko/ which creates a real-time history file in Renko candlesticks with a non-standard timeframe. We need to test it using the created file. However, renaming the resulting history file with a non-standard timeframe does not help. The tester shows TestGenerator: no history data 'GBPUSD5' from 2017.01.05 to 2017.06.14 It is created in the real time, not from the history, because the history does not get a very correct chart. Or, tweak the indicator itself so it creates a chart with the standard timeframe, preliminarily removing the appropriate one from the history. I have so far only managed to correct it so it creates a file but it is empty.

Торгуй с удовольствием! Свечи Ренко — построение графика «по кирпичику»
Торгуй с удовольствием! Свечи Ренко — построение графика «по кирпичику»
  • tradelikeapro.ru
Здравствуйте, друзья! На нашем сайте уже было несколько форекс стратегий для торговли по графикам Ренко (Renko), думаю стоит рассмотреть этот тип графиков отдельно, обсудить плюсы и минусы такого подхода к торговле. Также в рамках этого обзора мы познакомимся с альтернативным индикатором для построения графиков Ренко, т.к. часть старых утилит...
 
Andrey Sokolov:

Greetings.

Can you please tell me how to "slip" into MT4 tester a created history file with a timeframe that is not in the tester (or other options)?

The point is that there is an Expert Advisor, from here http://tradelikeapro.ru/grafiki-renko/ which creates a real-time history file in Renko candlesticks with a non-standard timeframe. We need to test it using the created file. However, renaming the resulting history file with a non-standard timeframe does not help. The tester shows TestGenerator: no history data 'GBPUSD5' from 2017.01.05 to 2017.06.14 It is created in the real time, not from the history, because the history does not get very correctly. Or, tweak the indicator itself so it creates a chart with the standard timeframe, preliminarily removing the appropriate one from the history. I have so far only managed to correct it so it creates a file but it is empty.

The Renko chart is the result of overlaying a low pass filter with a backlash on the history. MA gives a smooth curve, but Renko gives a stepped curve because of the backlash. Save the result of filtering in an array and keep working... I'll be free in a week or two and I'll get down to it

 

Can you guys tell me how to write in the code of the Expert Advisor to open 3 trades at once with the possibility of setting LS?

Here is my condition

if(MA_1>MA_2)
ticket=OrderSend(_Symbol,OP_BUY,Lots,Ask,0,Ask-SL*Point,Bid+TP*Point,NULL,0,0,clrGreen);
if(MA_1<MA_2)
ticket=OrderSend(_Symbol,OP_SELL,Lots,Bid,0,Bid+SL*Point,Ask-TP*Point,NULL,0,0,clrRed);

I've been advised to use(OrdersTotal()) function, but it does not fit my case. I wrote it like this

void OnTick()
  {
//---
   double MA_1;
   MA_1=iMA(_Symbol,0,1,0,1,0,0);
   double MA_2;
   MA_2=iMA(_Symbol,0,6,0,1,0,0);
   int ticket=0;
   if(OrdersTotal()<=3)
     {
      if(MA_1>MA_2)
         ticket=OrderSend(_Symbol,OP_BUY,Lots,Ask,0,Ask-SL*Point,Bid+TP*Point,NULL,0,0,clrGreen);
      if(MA_1<MA_2)
         ticket=OrderSend(_Symbol,OP_SELL,Lots,Bid,0,Bid+SL*Point,Ask-TP*Point,NULL,0,0,clrRed);
     }
//---
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }

It compiles well, no errors, but it is not appropriate for my case.

 
Citizens, please advise where to find an EA (order flipper)...
Ie its logic is as follows:
The first order is opened by a condition, and when other conditions appear, the first order is closed and the second order is opened by other conditions!!! Maybe there is somewhere to read about it?

I did what I could! But the orders will not close Help plz...

MA1_0 = iMA(_Symbol, _Period, ma1, 0, ma1_method, ma1_Price, 1);
MA1_1 = iMA(_Symbol, _Period, ma1, 0, ma1_method, ma1_Price, 2);

MA2_0 = iMA(_Symbol, _Period, ma2, 0, ma2_method, ma2_Price, 1);
MA2_1 = iMA(_Symbol, _Period, ma2, 0, ma2_method, ma2_Price, 2);

if(MA1_0 < MA2_0 && MA1_1 >= MA2_1) //sell
{
if(tp > 0) TP = NormalizeDouble(Bid - tp * _Point, _Digits); else TP = NULL;
ticket = OrderSend(_Symbol, OP_SELL, lot, Bid, slippage, 0, TP, NULL, Magic, 0, clrRed); //sell
Print("Error opening a sell order");
}
else
{
Print("Successful opening of the sell order");
}
else if(MA1_0 > MA2_0 && MA1_1 <= MA2_1)//buy
{
ticket_close = OrderClose (ticket, lot, Bid, slippage, clrRed);
Print("Sell order successfully closed");
}
else
{
Print("Error at closing the sell order");
}
 
Can you please advise why the EA stops seeing its orders (opens several orders instead of one) if there are other orders in addition to its orders? If only EA's orders - no problems. When opening an order the "Medjik" is set and only orders with this "Medjik" are selected according to the conditions of opening the order.
 
sviter-pro:
Citizens, please advise where to find an EA (order flipper)...
Ie its logic is as follows:
The first order is opened by a condition, and when other conditions appear, the first order is closed and the second order is opened by other conditions!!! Maybe there is somewhere to read about it?

I did what I could! But the orders will not close Help plz...

MA1_0 = iMA(_Symbol, _Period, ma1, 0, ma1_method, ma1_Price, 1);
MA1_1 = iMA(_Symbol, _Period, ma1, 0, ma1_method, ma1_Price, 2);

MA2_0 = iMA(_Symbol, _Period, ma2, 0, ma2_method, ma2_Price, 1);
MA2_1 = iMA(_Symbol, _Period, ma2, 0, ma2_method, ma2_Price, 2);

if(MA1_0 < MA2_0 && MA1_1 >= MA2_1) //sell
{
if(tp > 0) TP = NormalizeDouble(Bid - tp * _Point, _Digits); else TP = NULL;
ticket = OrderSend(_Symbol, OP_SELL, lot, Bid, slippage, 0, TP, NULL, Magic, 0, clrRed); //sell
Print("Error opening a sell order");
}
else
{
Print("Successful opening of the sell order");
}
else if(MA1_0 > MA2_0 && MA1_1 <= MA2_1)//buy
{
ticket_close = OrderClose (ticket, lot, Bid, slippage, clrRed);
Print("Sell order successfully closed");
}
else
{
Print("Error at closing the sell order");
}

Sell order is closed at Ask price

 
Anatoliy Ryzhakov:
Can you please advise why the EA stops seeing its own orders (opens several orders instead of one) if there are other orders beside its own? If the orders are only those of the EA, there is no problem. When opening an order the "Medjik" is set and only orders with this "Medjik" are selected according to the conditions of opening the order.

You have a break and need to continue

Reason: