Thanks to the author for the useful article, but IMHO it is necessary to check the code again, for example, I noticed that in methods CMySignalEnvelopes::LongCondition and CMySignalEnvelopes::ShortCondition the call is made on an unchecked for NULL pointer to the object m_signal, and in method CMySignalEnvelopes::GetPriceLevelStopp the subtraction from the current value of the uninitialised local variable temp... is applied.
Besides, before adopting your proposed mechanism of changing parameters of order opening, I would like to make sure of its correctness.
My doubts are as follows:
firstly, your parameter changes level out the value of the external setting of the Signal_PriceLevel Expert Advisor, which can mislead the user,
secondly, this change goes through the field of the main module, which can affect the work of other modules,
thirdly, the methods where it is done, functionally serve for a certain purpose.
In this case, to change the parameters of opening orders, the base class CExpertSignal has specific, virtual methods - OpenLongParams, OpenShortParams, which may have been intended by the developers to be overridden in the descendant classes, modules of custom signals, and to enable the call of these methods, it is enough at initialisation to call the General method and pass to it the object index from its class.
In general, I would like such articles as yours or mine, where extensions for system libraries are proposed, to be accompanied by at least a small comment from MQ developers of these libraries, because there are not so many such articles.
.
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.
Thank you for sharing, it's a great credit to newcomers.
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
***
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.
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.
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.
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
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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.
Author: Karputov Vladimir