Trade a chart permanent arrow's initial appearance ONLY once?

 

Compiled commercial indicator. iCustom it OK. Paints 6 permanent indicators (+ in Data window). Sometimes indicates more than one trade on the same tick, and not only at the opening of a new bar.

EA misses duplicate trades. Likewise if I only trade at new bar. If I run on every tick, it places trades every tick infinitely.

I'm thinking that this must not be all that uncommon of a problem?

Programming techniques, algorithm, approaches &/or suggestions for this (common) EA task?

Thanks for any and all assistance (< 8)

 
This looks promising and for wider application as well:

Visual Testing of the Profitability of Indicators and Alerts

 
FourX:

Compiled commercial indicator. iCustom it OK. Paints 6 permanent indicators (+ in Data window). Sometimes indicates more than one trade on the same tick, and not only at the opening of a new bar.

EA misses duplicate trades. Likewise if I only trade at new bar. If I run on every tick, it places trades every tick infinitely.

I'm thinking that this must not be all that uncommon of a problem?

Programming techniques, algorithm, approaches &/or suggestions for this (common) EA task?

Thanks for any and all assistance (< 8)

Hi FourX

I was looking for an EA that opens a buy or sell trade trade immediately that price action touches or penetrates a SMA or EMA. I found a very nice EA called "price cross MA" but it does not open a trade immediately when price line touches the moving average. Nor can you set it to either open a sell trade or a buy trade depending whether you are expecting price to "bounce" off or whether you expect it to penetrate through the MA.

Do you perhaps know of an EA that opens a buy or sell (to be set by me) trade when price touches an SMA or EMA?

Thanks!

 
jmtini: I was looking for an EA
Don't double post and don't hijack other peoples threads.
 
FourX:
Is a Thief and Troll Please do not feed the troll.

When you respond, you give the troll power. When you ignore the troll, he starves for attention and eventually dies.
 
Hmmm all the soultions to the origional post can be found in the codebase and in forum posts - not looking is LAZY and probably the actions of a Troll.
 

I was looking for an EA that opens a buy or sell trade trade immediately that price action touches or penetrates a SMA or EMA. I found a very nice EA called "price cross MA" but it does not open a trade immediately when price line touches the moving average. Nor can you set it to either open a sell trade or a buy trade depending whether you are expecting price to "bounce" off or whether you expect it to penetrate through the MA.

Do you perhaps know of an EA that opens a buy or sell (to be set by me) trade when price touches an SMA or EMA?

Thanks!


As you can see from my postings, I am having such difficulties as well and cannot really help you. Have you looked at the 2 EAs that come with MQL4?

'Moving Average' and 'MACD Sample'

I do have one such program that utilizes OCO that does what it sounds like you want. However it is among the downloadable code that one gets with either the hard copy or eBook on MQL4 EA Programming. If you are a NuB and overwhelmed and intimidated by this massive, complex subject and don't know where to start this is an excellent. Even more experienced programmers wanting a foundation of reusable Functions() in an Include.mqh file that allows one to construct their own (basic) EAs very readily. It is well worth the very reasonable price for it and would likely be of considerable assistance to you. Good luck.

 
Ickyrus:
Hmmm all the soultions to the origional post can be found in the codebase and in forum posts - not looking is LAZY and probably the actions of a Troll.

I find locating (anything specific) here difficult, time consuming and laborious at best. So if I can find the information in a fraction of the time by someone that knows it sharing it with me, I will very gladly do so. My ego isn't so fragile and at stake that I am concerned about 'what I look like' and what others 'will think about me' not knowing the answer to questions that I don't by spend hours wandering around aimlessly lost rather than asking questions that I don't know the answers to that I need to know.

If you wish to contribute, then do so. If not, then don't and keep your immature, personal insults, attacks, slanderous statements that are defamation of character to yourself.

 
Ickyrus:
Hmmm all the soultions to the origional post can be found in the codebase and in forum posts - not looking is LAZY and probably the actions of a Troll.
Apparently you lack the ability to understand even the basics of such things as the second post in this thread was by me of a link to an article that is relevant to this topic and problem. if you've got nothing to contribute, then don't put your foot in your mouth as it goes in quite readily.
 
Meant this posting for only one thread. But the other one is a completely different approach to the problem anyway and thus may attract different input, suggestions and solutions so I think that there is validity to it:

I'm getting very inconsistent trading activity with the EA using this Custom Indicator. The problem SEEMS(?) to stem from the fact that the indicator puts out multiple chart objects and alerts at the same time. With MT4 only having just the one active trading thread at a time, then with multiple simultaneous attempts obviously some are going to be blocked. I've increased IsTradeContextBusy() from 10 ms up to 25ms, with some, but very little results. Certainly not enough to be reliable. I am at least getting more 'TradeContextIsBusy' #146 Errors now

So looking for solutions to this. Again this can't be a new or unique MQL problem? What is the SOP for dealing with it?

The chart Indicator Objects that are indicative of trading actions don't disappear from the screen and these Object's values seem to be present in the Data Window for the entire Bar. So I should be able to access them other than when they just occur shouldn't I? I did put a time stamp on trading activities to try and help prevent duplicates.

But my problem is not being able to get my EA to place all of the trading activities generated by the Custom indicator consistently. The ONLY external variables are switches for 'Back Testing', showing the Alerts and that is about it.

So far I haven't been able to get the EA to close any trades at all even though the indicative chart objects and their Data values are there accompanied by the info in the Alert window.

The only thing that i have found in the logs is about what one expect 'Trade Context Busy'

Though of one approach was to immediately put ALL of the trading activity signals into a 'trading cue' and then process it in a loop. Arrays will only hold one type of info, so can't store all the factors of one trade action in one array (& location)

At one point when it was reacting every tick, then it repeatedly made the exact same trading action: opened up ~ 100 trades in a very short period of time )< 8)

PS: FYI: It just ticked over the hour on hourly charts and 7 alerts are showing, 3 of which are duplicates. That still leaves 4 trade actions to be carried out The EA made only one.

 
WHRoeder:
Is a Thief and Troll Please do not feed the troll.

When you respond, you give the troll power. When you ignore the troll, he starves for attention and eventually dies.


it is you, whroeder, that is the troll.

Reason: