› Forums › Development › Trading made REALLY Simple
This topic has been reported for inappropriate content
Tagged: Peak EA
- This topic has 455 replies, 41 voices, and was last updated 8 years, 9 months ago by
Anti.
- AuthorPosts
- February 6, 2016 at 10:04 pm #11463
How to EA Logic:
Now, after we have our SL, TP (?), Lots etc. and trading pre-conditions, we can implement the EA’s Logic itself.
This will be done in much the same way – by using FUNCTION calls (CS=CurrencyStrength, CM=ClearMethod, VZO=VolumeZoneOscillator, mySentimet=UserParam preference or Neutral):
//— LONG position (BUY) possibility
if (CS()==1. && CM()==1. && VZO==1. && mySentiment==1.)
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,….,Magic,0,Blue);
[etc.]//— SHORT position (SELL) possibility
if (CS()==-1. && CM()==-1. && VZO==-1. && mySentiment==-1.)
{
ticket=OrderSend(Symbol(),OP_SELL,Lots,….,Magic,0,Red);
[etc.]using this method the EA can easily be modified by changing/adding/deleting conditions without rewriting the whole logic.
Details on each function will follow.
G.
February 8, 2016 at 1:26 pm #11477Hello Guys, Dont want to be rude, and with all respect, but the title of thsi thread is : trading made REALLY simple… But the thing is thaht i understand nothing
Is it really SIMPLE ?I also don’t see anything simple in this thread, this is a thread about coding as far as I can tell and there is nothing simple about coding
February 8, 2016 at 11:12 pm #11480I also don’t see anything simple in this thread, this is a thread about coding as far as I can tell and there is nothing simple about coding
I must admit that there are trading terminals that have programming interfaces which are easier to handle for coding newbies than MT4.
But in the end, some coding is supposed to make trading easier. If you want other tools than the built-in RSI, MA, etc. you or somebody else has to code those tools. That’s a matter of fact. And I disagree that this thread is about coding only – the Coders’ Lounge is over here.
And I partially agree in one point: coding isn’t easy for everybody, but nearly everybody having some analytical skills can learn the basics, sufficient diligence assumed.
s.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
February 9, 2016 at 10:05 am #11484Hello Guys, Dont want to be rude, and with all respect, but the title of thsi thread is : trading made REALLY simple… But the thing is thaht i understand nothing
Is it really SIMPLE ?I also don’t see anything simple in this thread, this is a thread about coding as far as I can tell and there is nothing simple about coding
I’ll consider changing the thread name to:
“Watch-out: misleading title !!”
G.
February 9, 2016 at 1:10 pm #11487LMFAO
maybe you should G, LOL thanks for the laugh though, on a more serious note though, is this thread about you guys building an EAto trade for you which makes trading ”REALLY” simple?
-
This reply was modified 10 years, 2 months ago by
ZARtrader.
February 9, 2016 at 5:03 pm #11493LMFAO
maybe you should G, LOL thanks for the laugh though, on a more serious note though, is this thread about you guys building an EA to trade for you which makes trading ”REALLY” simple?This thread is about building an EA, based on Currency-Strength, Price-Action patterns, and Volume behaviour.
That’s the way I trade, for years, on a daily basis.
The Community EA should make this task available to everyone, and should make that task as simple as possible.
G.
February 9, 2016 at 5:31 pm #11494I think it’s time to update my formerly posted ‘GG53 compilation’ pdf to provide an overview of the most significant posts in both ‘really simple’ threads.
May also serve as sort of specification sheet for fellow coders.
s.
Attachments:
You must be logged in to view attached files.A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
February 9, 2016 at 10:37 pm #11500Hey guys:
There were private questions relating our Penguin EA v. 1.4. I just forgot to mention that: you have to permit DLL calls when launching the EA, if you haven’t activated DLL use permanently.
The event calendar functions require that. If you do not permit DLL, the EA cannot run.
s.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
February 9, 2016 at 11:23 pm #11502I received a PM about our EA v.1.4 throwing out a message like:
2016.02.09 23:57:07 2016.01.04 11:59 Penguin_v_1_4 EURUSD,H4: SellStop Price 1.09038 too close to current price 1.09068 Min distance = 0.00300
Hopefully some more detail will follow, so we can start debugging. I have an idea where to look, but more detail would be helpful!
If anybody testing the EA gets some error messages, please post!
Thanks,
s.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
February 10, 2016 at 4:19 am #11503Hey guys: There were private questions relating our Penguin EA v. 1.4. I just forgot to mention that: you have to permit DLL calls when launching the EA, if you haven’t activated DLL use permanently. The event calendar functions require that. If you do not permit DLL, the EA cannot run. s.
About the indicators. In order the EA to work, we must create a folder name “__EA” (without double quote) under …/MQL4/Indicators/ folder , and copy all indicators needed by the EA to this “MQL4/Indicatos/__EA/” folder.
edit: And thanks for the Pdf too
Great work, thanks a lot Simplex

-
This reply was modified 10 years, 2 months ago by
smallcat.
February 11, 2016 at 11:28 pm #11534I received a PM about our EA v.1.4 throwing out a message like: 2016.02.09 23:57:07 2016.01.04 11:59 Penguin_v_1_4 EURUSD,H4: SellStop Price 1.09038 too close to current price 1.09068 Min distance = 0.00300 Hopefully some more detail will follow, so we can start debugging. I have an idea where to look, but more detail would be helpful! If anybody testing the EA gets some error messages, please post! Thanks, s.
Hi Simplex & Co.
Highly appreciate you guys and your effort for the community. As I can’t code, I try my best with testing this EA. So as I mentioned, I got above error while back testing (see attached log.txt). I tried also forward testing and got the same error, no difference at all. EA run with default settings. So I’m wondering what it might be related to, especially when nobody else mentioned it so far.
Thank you,
MilanAttachments:
You must be logged in to view attached files.February 12, 2016 at 12:49 am #11537Hi Simplex & Co. Highly appreciate you guys and your effort for the community. As I can’t code, I try my best with testing this EA. So as I mentioned, I got above error while back testing…
Hello, this is not EA error, it is your trading account limitation (stoplevel 30 pips), try to set “StopOrdersBuffer” property 30+ pips.
February 13, 2016 at 10:24 am #11545Hi Simplex & Co. Highly appreciate you guys and your effort for the community. As I can’t code, I try my best with testing this EA. So as I mentioned, I got above error while back testing…
Hello, this is not EA error, it is your trading account limitation (stoplevel 30 pips), try to set “StopOrdersBuffer” property 30+ pips.
Hi everybody. I have been trying to backtest the EA with the default settings and getting this same error. I even modified the “StopOrdersBuffer” property but the error still persists.
Am not a coder, any help will be greatly appreciated.
Thanks.
February 13, 2016 at 11:11 am #11546Thanks for reporting. Obviously the problem occurs when functions BuyStop() and SellStop() are called for an entry:
double stopLevel = MarketInfo(sym, MODE_STOPLEVEL) * point; if (price - ask <= stopLevel) { Print(__FUNCTION__ + " Price " + price2String(price) + " too close to current price " + price2String(ask) + " Min distance = " + price2String(stopLevel)); return; }To have a closer look at your MT4 environment, please download the attached script (no indicator!), compile and run it on a EURUSD chart. It will print several MarketInfo() information in your most recent logfile.
Please cut the relevant information into a .txt file and post it here or send it to me via PM (posting would be better so others could look at it, too). The relevant information should look like this:
0 11:56:31.006 Script PrintMarketinfo_Post EURUSD,H4: loaded successfully 0 11:56:31.036 PrintMarketinfo_Post EURUSD,H4: initialized 0 11:56:31.036 PrintMarketinfo_Post EURUSD,H4: Symbol = EURUSD ( ... even more content ... ) 0 11:56:31.036 PrintMarketinfo_Post EURUSD,H4: Stop level in points ( MODE_STOPLEVEL ) = 0 0 11:56:31.036 PrintMarketinfo_Post EURUSD,H4: uninit reason 0 0 11:56:31.036 Script PrintMarketinfo_Post EURUSD,H4: removedYou will find the logfile in <your_mt4_data_folder>/MQL4/Logs
s.
Attachments:
You must be logged in to view attached files.A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
February 13, 2016 at 11:17 am #11548@VlanFx: maybe it would be a good idea to cut the function from my above posted script and integrate it in the EA. Calling the function once during OnInit() might support debugging.
s.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
February 14, 2016 at 6:40 am #11552@VlanFx: maybe it would be a good idea to cut the function from my above posted script and integrate it in the EA. Calling the function once during OnInit() might support debugging. s.
Good idea.
Also add “Debug” (true/false) to user’s parameters to optionally activate/deactivate this function in OnInit().
G.
February 14, 2016 at 11:18 pm #11557February 15, 2016 at 8:28 am #11561Hi kapybara,
Here is output from your script. I run it on 2 brokers where I had the same issue.
Thanks for reporting! According to your output, the error should NOT occur on your GP account, where
Stop level in points ( MODE_STOPLEVEL ) = 0. On MaxFx the case is clear withStop level in points ( MODE_STOPLEVEL ) = 10As a workaround, please try setting your parameter StopOrdersBuffer to a value greater than the account setting MODE_STOPLEVEL and report back whether this works now. We should be aware of the fact that this will affect EA performance to some minor extent.
I will write a checkup routine that can be called in OnInit() to report if account setting and EA setting show a mismatch. If anybody has additional ideas what to check that way at startup please post! @VlanFx: what’s your opinion about this?
s.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
February 15, 2016 at 5:27 pm #11563February 15, 2016 at 8:23 pm #11564I’m afraid that this won’t be enough. The circumstances kapybara & forexdj reported will prevent the EA from opening trades. The error occured in functions BuyStop and SellStop. So this particular check has to be made before an entry, but during trailing as well.
s.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
February 18, 2016 at 3:38 pm #11634All hi!
First I want to thank all who took part in creation of this EA, and in particular Gg53. Thank you that you share with us secrets!
I read all subject and started testing, but I had some problems! The first PeakTroughEA version was better than the others. In a year she showed a monthly gain of 30% at the fixed lot, and drowdown in 8%.
Version 1.4 at me doesn’t open the order.
Then I started trying earlier version 1.3, but even having disconnected additional settings and having chosen the same period and TP and SL it showed results worse than the first version.
Why so? maybe who has kept settings for version 1.3-1.4? I could continue optimization further.
yours faithfully TMAttachments:
You must be logged in to view attached files.Ничто не ново под луной:
Что было, то и будет.
Я завершаю круг и - вновь
Готов бежать по кругу...February 19, 2016 at 9:54 pm #11672Hi kapybara,
Here is output from your script. I run it on 2 brokers where I had the same issue.
Thanks for reporting! According to your output, the error should NOT occur on your GP account, where
Stop level in points ( MODE_STOPLEVEL ) = 0.Hi simplex
Thanks for v1.4. I finally tested it, works fine on my side.
I checked the reported error, and looks like 0 value for STOPLEVEL doesn’t necessarily mean no restrictions:
A zero value of MODE_STOPLEVEL means either absence of any restrictions on the minimal distance for Stop Loss/Take Profit or the fact that a trade server utilizes some external mechanisms for dynamic level control, which cannot be translated in the client terminal.
So that’s bad news. There can be something running that we can not see and check.
So I opened a demo account at GP and backtested the EA and it worked correctly, Opening trades at 3 pips from actual price with StopLevel showing 0. So now I’m confused.
@kapybara are you still experiencing this problem?
V.
February 19, 2016 at 10:36 pm #11673Hey guys,
Sorry for late response on this. So let’s summarize it. I have 2 demo accounts with MaxFX and GlobalPrime. Both are showing different pending order limitations (see picture).
And both brokers/accounts are throwing me the same warning:
0 23:14:37 2016.02.01 12:28 Penguin_v_1_4 EURUSD,H4: SellStop Price 1.08583 too close to current price 1.08613 Min distance = 0.00300
When I adjusted StopOrdersBuffer to 31.0 pips or 30.1 pips it started to open trades. But BUYSTOP/SELLSTOP ORDER distance 30 pips is way too far.
Wondering what it might be. I saw you have the same GP broker/demo acc, even Simplex has the same GP broker 950 build. I’m confused a bit

Thanks,
Milan
-
This reply was modified 10 years, 2 months ago by
kapybara.
Attachments:
You must be logged in to view attached files.February 20, 2016 at 2:10 pm #11680
AnonymousAll hi!
First I want to thank all who took part in creation of this EA, and in particular Gg53. Thank you that you share with us secrets!
I read all subject and started testing, but I had some problems! The first PeakTroughEA version was better than the others. In a year she showed a monthly gain of 30% at the fixed lot, and drowdown in 8%. Version 1.4 at me doesn’t open the order. Then I started trying earlier version 1.3, but even having disconnected additional settings and having chosen the same period and TP and SL it showed results worse than the first version. Why so? maybe who has kept settings for version 1.3-1.4? I could continue optimization further. yours faithfully TMI dont think its nesseseary to check scores and to optimize it yet. There is still some stuff left to do/add for it to be ready for this.
Hi kapybara,
Here is output from your script. I run it on 2 brokers where I had the same issue.
Thanks for reporting! According to your output, the error should NOT occur on your GP account, where
Stop level in points ( MODE_STOPLEVEL ) = 0.Hi simplex Thanks for v1.4. I finally tested it, works fine on my side. I checked the reported error, and looks like 0 value for STOPLEVEL doesn’t necessarily mean no restrictions: A zero value of MODE_STOPLEVEL means either absence of any restrictions on the minimal distance for Stop Loss/Take Profit or the fact that a trade server utilizes some external mechanisms for dynamic level control, which cannot be translated in the client terminal. So that’s bad news. There can be something running that we can not see and check. So I opened a demo account at GP and backtested the EA and it worked correctly, Opening trades at 3 pips from actual price with StopLevel showing 0. So now I’m confused. @kapybara are you still experiencing this problem? V.
Here is full list of: order limiations
Some brokers have there chart price shifted with the actual price (MarketsWach have always the correct price .. MarketInfo(functions..).
This is because Metatrader have only one price fees and if brokers have more than one price to offer there costumers it could mess there chartprice.
I have only found two brokers that have this, FXCM (only if account currency is USD) and HotForex but there is more of them out there.
So for example, if EA is trying to create the Buystop and the real Ask price is equal or above the price that it is trying to create the order on (this price is taken from chart) than it could not create order. iLow iHigh, and all indicators are using chartprice so we have to shift it if there is a diff from the actual price.
Not many people know about this and I have only found 1 more EA exept mine on MQL Market that have this corrected.
We can check this in OnInit() and then correct all prices we use from chart.
Here is shift code example:
int OnInit(void)
{
RefreshRates(); // very important!!
chartoffset = MarketInfo(symbol, MODE_BID) – iClose(symbol, 0, 0);
if (chartoffset != 0) PrintFormat(“Chartprice is shifted with %.f points”, chartoffset / Point);
…
now we add this to ‘orderprice + chartoffset’ to have it corrected.
February 20, 2016 at 3:00 pm #11682Wondering what it might be. I saw you have the same GP broker/demo acc, even Simplex has the same GP broker 950 build. I’m confused a bit
Yes, a bit confusing! Milan, would you mind asking GP Support for an explanation of this issue? You’re the one whose account is hit by those limitations, so I think it makes sense that you would ask.
If their support does not provide a satisfactory answer, you might place your question in public via Steve Hopwood’s forum, where GP has a partner account. I remember their partner Jemook @ SHF to be really helpful and honest in replying to issues.
I’m sure most of us will be interested in their answer.
s.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
-
This reply was modified 10 years, 2 months ago by
- AuthorPosts
- You must be logged in to reply to this topic.