Call Custom Indicator with arrow In EA
- MicroSpiderfx
- Trader
- Posts: 15
- Joined: Fri Feb 27, 2015 12:46 pm
Call Custom Indicator with arrow In EA
Hey, I am Learning Mql4 coding and already done all basic . Now i want to know the technique for call custom indicator with Arrow. I have no mql4 file.
You do not have the required permissions to view the files attached to this post.
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Call Custom Indicator with arrow In EA
You are starting a journey of doom and despair that will soon have you describing these bloody Custom Indicators as Crap Custom Abortions, just as I do.
If you are lucky and the custom indi was coded by one of our resident genius' you are ok. If not, you are probably stuffed.
Indicators store information in 'buffers' (or should - the worst examples of this type of rubbish do not even do that).
Open the data window - ctrl+D - and hover your mouse over a candle to see what values, if any, are being held in the CCA's buffers.
Just to try to confuse normal people, CrapQl4 considers the first buffer to be buffer 0, but CrapperTrader4 displays this buffer as the name of the CCA (usually, not always) then moves to 'Value 2', implying that the indicator name is Value 1 despite this being buffer 0.
Welcome to my world. You will be sorry you entered it.
The proper coders here will release .mq4 files and we can look to see which buffers store which information. If unsure, we can ask the coder. You only have the .ex4 file and so have to work out which buffer contains a value that makes the CCA print an arrow.
Looking at your particular coding balls up, it looks as though the indicator name field is not blank when there is a blue arrow. So, if CCA buffer 0 holds a price, then you have a blue arrow on the chart.
'Value 6' appears not to be blank when there is a red arrow on the chart. This is CCA buffer 5.
A call to a CCA consists of these parts:
First, I have a set of external inputs so that users can tailor the indi to their own experimentation:
Then I have a function that reads TMA and returns a value:
Notice how everything is a parameter passed to the function by the call to it? This makes the code easily reusable - something I learned from the Proper Coders here at SHF.
Then, wherever appropriate, we call the function that reads the CCA. Mine looks like this:
There is one more thing to remember and it is this: sometimes the blank buffers hold a zero value; sometimes they hold the CrapQl4 constant EMPTY_VALUE. EMPTY_VALUE is a ridiculously high integer that the market will never reach. When dealing with .ex4 files and you do not have the source, you need to find out which value the CCA lunatic was using to tell the damn thing not to print on your chart the thingy it will print when it does hold a value.
I do this with an Alert, so I make sure my first call is to a blank candle and see what value the Alert shows. In the above example, shift = 1, so assuming that candle did not hold whatever I was looking for, my Alert would be:
Alert(RedUpperTmaVal);
That way, I know which value the coder is using to generate a blank field.
Be warned; some cretins use both EMPTY_VALUE and zero. Yes. Really. They really, really do. Test every field you interrogate.
One final point. All these Crap Custom Abortions do is send calls to the regular indicators that ship with CrapperTrader4 and display the info in a different way. Usually to make the cretin coder look clever - and especially to separate the gullible from their cash.
Custom Indicators coded by the resident genius' here at SHF have a point and purpose. They add value. They are useful and helpful. Frankly, if your Custom Indi wasn't coded by one of these guys, then your best interests are served by dumping it in the bin and forgetting it.
Hope this helps.

If you are lucky and the custom indi was coded by one of our resident genius' you are ok. If not, you are probably stuffed.
Indicators store information in 'buffers' (or should - the worst examples of this type of rubbish do not even do that).
Open the data window - ctrl+D - and hover your mouse over a candle to see what values, if any, are being held in the CCA's buffers.
Just to try to confuse normal people, CrapQl4 considers the first buffer to be buffer 0, but CrapperTrader4 displays this buffer as the name of the CCA (usually, not always) then moves to 'Value 2', implying that the indicator name is Value 1 despite this being buffer 0.
Welcome to my world. You will be sorry you entered it.
The proper coders here will release .mq4 files and we can look to see which buffers store which information. If unsure, we can ask the coder. You only have the .ex4 file and so have to work out which buffer contains a value that makes the CCA print an arrow.
Looking at your particular coding balls up, it looks as though the indicator name field is not blank when there is a blue arrow. So, if CCA buffer 0 holds a price, then you have a blue arrow on the chart.
'Value 6' appears not to be blank when there is a red arrow on the chart. This is CCA buffer 5.
A call to a CCA consists of these parts:
- The chart symbol
- The time frame (0 = current chart tf)
- The CCA name
- A list of values that have to match those of the inputs you see when you load the CCA onto your chart.
- The buffer you are interrogating.
- The candle shift of the candle whose values you require - 0 means 'now' whilst 1 means the close of the previous candle and so on.
First, I have a set of external inputs so that users can tailor the indi to their own experimentation:
Code: Select all
extern string sep3="================================================================";
extern string tmar="---- TMA Red inputs ----";
extern int RedTimeframe = 0;
extern int RedHalfLength = 20;
extern double RedAtrMultiplier = 3.5;
extern int RedAtrPeriod = 100;
extern int RedBarsToProcess = 0;
bool RedAlerts = false;
////////////////////////////////////////////////////////////////////////////////////////
double RedUpperTmaVal=0, RedLowerTmaVal;
////////////////////////////////////////////////////////////////////////////////////////
Code: Select all
double GetTma(string symbol, int tf, int itf, int half, double multiplier, int per, int process, bool alerts, int buffer, int shift)
{
return(iCustom(symbol, tf, "TmaTrue", itf, half, multiplier, per, process, alerts, buffer, shift));
}//End double GetTma(string symbol, int tf, int itf, int half, double multiplier, int period, int process, bool alerts =false, int buffer, int shift)
Then, wherever appropriate, we call the function that reads the CCA. Mine looks like this:
Code: Select all
//TMA
//TMA red
//Buffer 1 holds the upper line
RedUpperTmaVal = GetTma(Symbol(), 0, RedTimeframe, RedHalfLength, RedAtrMultiplier, RedAtrPeriod, RedAtrPeriod, RedAlerts, 1, shift);
//Buffer 2 holds the lower line
RedLowerTmaVal = GetTma(Symbol(), 0, RedTimeframe, RedHalfLength, RedAtrMultiplier, RedAtrPeriod, RedAtrPeriod, RedAlerts, 2, shift);
I do this with an Alert, so I make sure my first call is to a blank candle and see what value the Alert shows. In the above example, shift = 1, so assuming that candle did not hold whatever I was looking for, my Alert would be:
Alert(RedUpperTmaVal);
That way, I know which value the coder is using to generate a blank field.
Be warned; some cretins use both EMPTY_VALUE and zero. Yes. Really. They really, really do. Test every field you interrogate.
One final point. All these Crap Custom Abortions do is send calls to the regular indicators that ship with CrapperTrader4 and display the info in a different way. Usually to make the cretin coder look clever - and especially to separate the gullible from their cash.
Custom Indicators coded by the resident genius' here at SHF have a point and purpose. They add value. They are useful and helpful. Frankly, if your Custom Indi wasn't coded by one of these guys, then your best interests are served by dumping it in the bin and forgetting it.
Hope this helps.
Read the effing manual, ok?
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
- MicroSpiderfx
- Trader
- Posts: 15
- Joined: Fri Feb 27, 2015 12:46 pm
Call Custom Indicator with arrow In EA
:hi: Thank you for your valuable reply .
-
Jexodus
- Posts: 4
- Joined: Wed Sep 16, 2015 12:08 am
Call Custom Indicator with arrow In EA
For want of not starting another thread, I am having a similar issue that I'm trying to resolve. I am trying to develop my first EA to place trades based off signals from some indicators that I have (I only have ex4 files).
I have three indicators that display a colour matrix for two stoch's, MACD and RSI. These all run in Indicator Window 2, however when I use display the Data Window, as Steve described above, the indicator window does not show up in the Data Window list. It lists the others, just not indicator window number 2.
Is there any other way to access this information from these indicators? My next step if this can't be done is to code my own matrix (which gives the added benefit of learning the ins and outs of how these types of indicators are coded). Only thing stopping me going straight down that path is that I'm not 100% on the colour change triggers for the matrix. I'd like to build the EA off the current data to make sure the idea is feisable. Either way, I get to learn something.
Thank you in advance. Files attached below.
I have three indicators that display a colour matrix for two stoch's, MACD and RSI. These all run in Indicator Window 2, however when I use display the Data Window, as Steve described above, the indicator window does not show up in the Data Window list. It lists the others, just not indicator window number 2.
Is there any other way to access this information from these indicators? My next step if this can't be done is to code my own matrix (which gives the added benefit of learning the ins and outs of how these types of indicators are coded). Only thing stopping me going straight down that path is that I'm not 100% on the colour change triggers for the matrix. I'd like to build the EA off the current data to make sure the idea is feisable. Either way, I get to learn something.
Thank you in advance. Files attached below.
You do not have the required permissions to view the files attached to this post.
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Call Custom Indicator with arrow In EA
I had a quick look at the stochastic and cannot find anything recorded in any of the buffers available to the coder.
Why bother with it?
It looks as though it places a visual representation of two calls to stoch. There is a red sell dot when stoch is > Upper_limit and green when < Lower_Limit and some sort of slate-grey when in between. The only thing this indi brings to the table is having the dots in alignment in one graphic instead of having two stoch indi's on the chart.
Tough stuff, reading stoch indis off the chart. People need a PhD in quantum physics before they can even begin to contemplate doing so. Much better to have a coloured dot that an ea cannot read because the coder could not be arsed to store the data in a buffer.
Shall I stop now?
So forget the CCA and send your own individual calls to stoch with the same values as set in the inputs of the cca.
I repeat, there is nothing magical about these things. All they do is parcel up info that is already readily available by calling the standard indi's. Look on the bright side. At least the author of this cca has not attempted to hide his basic use of stoch by calling it, "The Most Mystical Magical Indicator Of The Decade" or some such.

Why bother with it?
It looks as though it places a visual representation of two calls to stoch. There is a red sell dot when stoch is > Upper_limit and green when < Lower_Limit and some sort of slate-grey when in between. The only thing this indi brings to the table is having the dots in alignment in one graphic instead of having two stoch indi's on the chart.
Tough stuff, reading stoch indis off the chart. People need a PhD in quantum physics before they can even begin to contemplate doing so. Much better to have a coloured dot that an ea cannot read because the coder could not be arsed to store the data in a buffer.
Shall I stop now?
So forget the CCA and send your own individual calls to stoch with the same values as set in the inputs of the cca.
I repeat, there is nothing magical about these things. All they do is parcel up info that is already readily available by calling the standard indi's. Look on the bright side. At least the author of this cca has not attempted to hide his basic use of stoch by calling it, "The Most Mystical Magical Indicator Of The Decade" or some such.
Read the effing manual, ok?
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
-
Radar
- Trader
- Posts: 437
- Joined: Fri Mar 23, 2012 5:39 pm
- Location: Round the bend ;)
Call Custom Indicator with arrow In EA
Hey Steve,
Where's the bloody "Like" button?
Where's the bloody "Like" button?
Check out my new, (well, old now), manual trade & automatic scale-in manager,
StackManV2
StackManV2
-
Jexodus
- Posts: 4
- Joined: Wed Sep 16, 2015 12:08 am
Call Custom Indicator with arrow In EA
Steve, thanks for taking the time to reply.
I sat down with the four indicators and figured out what the triggers were (the hardest being the MACD because it looked like it ran off a variable mean over a certain mount of bars - not the signal line). I've since coded the triggers into my own EA and tweaked them further. After the first round of testing the EA seems to be worth perfecting...
So, I learned a great deal and think I've achieved a better product. Thank you again for your guidance, greatly appreciated....
Anyway, onto my next minor error....max orders....
I sat down with the four indicators and figured out what the triggers were (the hardest being the MACD because it looked like it ran off a variable mean over a certain mount of bars - not the signal line). I've since coded the triggers into my own EA and tweaked them further. After the first round of testing the EA seems to be worth perfecting...
So, I learned a great deal and think I've achieved a better product. Thank you again for your guidance, greatly appreciated....
Anyway, onto my next minor error....max orders....
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Call Custom Indicator with arrow In EA
Well done. You will never regret coming to grips with this stuff.Jexodus » Mon Oct 05, 2015 9:58 am wrote:Steve, thanks for taking the time to reply.
I sat down with the four indicators and figured out what the triggers were (the hardest being the MACD because it looked like it ran off a variable mean over a certain mount of bars - not the signal line). I've since coded the triggers into my own EA and tweaked them further. After the first round of testing the EA seems to be worth perfecting...
So, I learned a great deal and think I've achieved a better product. Thank you again for your guidance, greatly appreciated....
Anyway, onto my next minor error....max orders....
Read the effing manual, ok?
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.