Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1135

 
MrBrooklin:

Here is a recent example (all based on your parameters):


A Sell Limit Pending Order was placed at 0700 hours - this is correct. But it didn't work until 12:04 - that's what confused you.

 

Forum on Trading, Automated Trading Systems and Strategy Tests

FAQ from Beginners MQL5 MT5 MetaTrader 5

Vladimir Karputov, 2019.10.14 13:46

Thanks for the clarification.

Just look at the "History" tab in the visual tester

History tab

Of course you can, but only if you understand what you are doing and what parameter is responsible for.


When testing this EA, I did not find any pending order in the History tab, only BUY or SELL. Or maybe that was just an example of another EA shown in the picture?

And one more thing.

If the FilterTime module is designed to limit the work of EAs to certain hours, what else should I understand to make it work only by certain hours?

Sincerely, Vladimir.


 
MrBrooklin:

When testing this EA on the History tab I didn't find any pending orders, only BUY or SELL. Or is it just an example from another EA shown in the picture?

***


I tried to run your EA on your parameters.

In the visual strategy tester, select "Orders and trades":


 

I am not showing any pending orders for some reason.

Regards, Vladimir.


 

Forum on Trading, Automated Trading Systems and Strategy Tests

FAQ from Beginners MQL5 MT5 MetaTrader 5

Vladimir Karputov, 2019.10.14 14:07

I have been running your EA on your parameters.

In the visual strategy tester, in the tab select "Orders and trades":


Thank you Vladimir. That makes sense now. I have been watching it in the wrong mode.

I still cannot understand why a pending order is placed instead of opening a position. Is it something wrong in the settings?

Best regards, Vladimir.


 
MrBrooklin:

Thank you, Vladimir. That makes sense now. I was looking at it in the wrong mode.

I still do not understand why a pending order is set instead of opening a position.

Sincerely, Vladimir.


The answer should be found here:Price level to execute a deal.

From the articleMQL5 Wizard: How to teach the Expert Advisor to open pending orders at any price:


Pay attention to theSignal_PriceLevel parameter. By default, the Expert Advisor is generated withSignal_PriceLevel=0. This parameter controls the indent from the current price. If the value is zero, the order will be opened at the current market price. To open a pending order, set a non-zero value forSignal_PriceLevel parameter, i.e.Signal_PriceLevel can be either less than zero or greater.

Signal_PriceLevel is specified in "big" points. The figures below show the difference between negative and positive values:

WhenSignal_PriceLevel=-50:

Figure 1. Signal_PriceLevel=-50

Figure 1. Signal_PriceLevel=-50

WhenSignal_PriceLevel=50:

Figure 2. Signal_PriceLevel=50

Figure 2. Signal_PriceLevel=50

Thus, ifSignal_PriceLevel=50, the pending order will be opened at a worse price than the current one, while ifSignal_PriceLevel=50, the pending order will be opened at a better price.

 
Snajper007:
Hello, could you please tell me how to do this? How do I spell the condition correctly: *if there is a new hour*?
if(NewBar(PERIOD_H1))Alert("Наступил новый час!");
//----
bool NewBar(ENUM_TIMEFRAMES TF = 0)
  {
   static datetime NewTime=0;
   if(NewTime!=iTime(Symbol(),TF,0))
     {
      NewTime=iTime(Symbol(),TF,0);
      return(true);
     }
   return(false);
  }
//----
 

Forum on Trading, Automated Trading Systems and Strategy Tests

FAQ from Beginners MQL5 MT5 MetaTrader 5

Vladimir Karputov, 2019.10.14 14:20

You should look for the answer here:"Price level to execute a deal".

From the articleMQL5 Wizard: How to teach your Expert Advisor to open pending orders at any price:


Pay attention to theSignal_PriceLevel parameter. By default, the Expert Advisor is generated with Signal_PriceLevel=0. This parameter controls the indent from the current price. If the value is zero, the order will be opened at the current market price. To open a pending order, set a non-zero value for Signal_PriceLevel parameter, i.e.Signal_PriceLevel can be either less than zero or greater.

Signal_PriceLevel is specified in "big" points. The figures below show the difference between negative and positive values:

WhenSignal_PriceLevel=-50:


Figure 1. Signal_PriceLevel=-50

WhenSignal_PriceLevel=50:


Figure 2. Signal_PriceLevel=50

Thus, ifSignal_PriceLevel=50, the pending order will be opened at a worse price than the current one, while if Signal_PriceLevel=50, the pending order will be opened at a better price.


Thank you very much, Vladimir, for your detailed and detailed reply.

Respectfully, Vladimir.

 
Iurii Tokman:
Thank you! I'll give it a try now.
 
Snajper007:
Thank you! I'll give it a try now.

if for mt5 it will be slightly different

Reason: