Discussion of article "MQL5 Wizard: How to Teach an EA to Open Pending Orders at Any Price"

 

New article MQL5 Wizard: How to Teach an EA to Open Pending Orders at Any Price has been published:

The article describes a method of modifying the code of a trading signal module for the implementation of the functionality allowing you to set pending orders at any distance from the current price: it may be the Close or Open price of the previous bar or the value of the moving average. There are plenty of options. Important is that you can set any opening price for a pending order. This article will be useful to traders who trade with pending orders.

An Expert Advisor generated using the MQL5 Wizard can only open pending orders at the fixed distance from the current price. This means that if the market situation changes (e.g. a change in market volatility), the Expert Advisor will have to be run again with new parameters.

This would not be suitable for many trading systems. In most cases, the price level for pending orders is determined dynamically by a trading system. And the distance from the current price is constantly changing. In this article, we will discuss how to modify an Expert Advisor generated using the MQL5 Wizard so that it can open pending orders at varying distances from the current price.

Fig. 1. Signal_PriceLevel=-50

Author: Karputov Vladimir

 

thanks for your code. it's very helpful.

by the way, i am trying to run the code, the result include buy and sell in different prices, but the profit column is always ZERO, even there are some deals.

this happens with different symbols and times.

your help is much appreciated.

Files:
 

Hi Karputov

Thank you for this wonderful tutorial. I wanted to ask you is it possible to modify this code to make the EA Open hedge pending orders?

I only trade in Gold with the following strategy:

1. if 12 SMA crosses above 20 SMA, then I want to open a set of buy stop & sell limit orders as below;

For e.g. the current price when SMA crosses is $1300.00 then;

1st buy stop @ 1302.00 & sell limit @ 1302.50

2nd buy stop @ 1303.00 & sell limit @ 1303.50

3rd buy stop @ 1304.00 & sell limit @ 1304.50

4th buy stop @ 1305.00 & sell limit @ 1305.50


2. if 12 SMA crosses below 20 SMA, then I want to open a sell stop & buy limit orders as below;

For e.g. the current price when SMA crosses is $1300.00 then;

1st sell stop @ 1298.00 & buy limit @ 1297.50

2nd sell stop @ 1297.00 & buy limit @ 1296.50

3rd sell stop @ 1296.00 & buy limit @ 1295.50

4th sell stop @ 1295.00 & buy limit @ 1294.50


I need the EA to accept the order size manually and then place the pending orders based on the above SMA crosses. I'm currently trading on the MT4 platform with a virtual server and have searched everywhere for an EA to do this. Only closest I have found is your EA for MT5 platform so I'll switch to MT5 if I have to. I hope you can help me code this.


thanks

Dev

 
Deven Parmar :

***

I need the EA to accept the order size manually and then place the pending orders based on the above SMA crosses. I'm currently trading on the MT4 platform with a virtual server and have searched everywhere for an EA to do this. Only closest I have found is your EA for MT5 platform so I'll switch to MT5 if I have to. I hope you can help me code this.

***

You need to look for a suitable advisor in CodeBase. Or contact Freelance. Your question is not on the topic of this article.

 
Vladimir Karputov:

You need to look for a suitable advisor in CodeBase. Or contact Freelance. Your question is not on the topic of this article.

I understand that it is not on the topic of this article, but is it possible you can help me modify and re-code this EA to work as I want it to? I'm not very good with coding.

 
Deven Parmar :

I understand that it is not on the topic of this article, but is it possible you can help me modify and re-code this EA to work as I want it to? I'm not very good with coding.

You write in the discussion article. You'd better create a topic on the forum "Help me find an adviser who works with pending orders." Maybe you can help.

 
Vladimir Karputov:

You write in the discussion article. You'd better create a topic on the forum "Help me find an adviser who works with pending orders." Maybe you can help.

Ah right, I understand now what your saying. Thanks

 

hello vladimir,


 i like this article, is it possible to write an EA that uses only pending orders to open trades with using another indicator. for eample if the price moves in one direction by 5 it triggers a buy or sell regardless.

 
Tafadzwa Nyamwanza :

hello vladimir,


 i like this article, is it possible to write an EA that uses only pending orders to open trades with using another indicator. for eample if the price moves in one direction by 5 it triggers a buy or sell regardless.

Are you sure your question relates to an article MQL5 Wizard: How to Teach an EA to Open Pending Orders at Any Price?

 
Hey Vladimir.

I know this Article is about Pending Orders but how do you program your EA to open a market order ?

 
Ayanda Mhlauli:
Hey Vladimir.

I know this Article is about Pending Orders but how do you program your EA to open a market order ?

input double             Signal_PriceLevel         =0.0;         // Price level to execute a deal
Reason: