Please help with a very simple indicator!

 

Hi all

 

Ok I know some will laugh, but I need help with an ultra simple indicator. If anyone who understands MT4 code has a spare ten minutes (or maybe this indicator laying around) - any chance of helping me?

 

I need to plot a simple one line/point (whatever) indicator below my chart which plots the number of open trades on the symbol I have attached the indicator to (regardless of timeframes) but also linked to a Magic Number. That's it!!

 

So if I currently have 3 longs and 1 short on the EURUSD based on 4 different strategies, and 3 of the strategies have the same magic number, when I attach this indicator to any EURUSD chart (regardless of timeframe) and use that same magic number it will simply plot a value of "3" (even though there are technically 4 open trades on the EURUSD, but one of them does not share the same magic number as the other 3 which happens to be the magic number I assigned to this indicator).

If I have 2 positions on GBPUSD, but under different magic numbers, when I attach it to a GBPUSD chart and assign it to one of the magic numbers, it just simply plots a value of "1". If both positions actually shared that same magic number, then it would plot "2".

Etc.. 

 

I hope somebody can help!! Many thanks to you all.

 

Pinky :) 

 
These guys can help you. Otherwise you may actually have to learn how to code and that might take over 10-minutes.
 
pinky:

Hi all

 Ok I know some will laugh, but I need help with an ultra simple indicator. If anyone who understands MT4 code has a spare ten minutes (or maybe this indicator laying around) - any chance of helping me?

I've just spent the last 10 minutes thinking of the best way to implement this type of Indicator . . .   unfortunately that means that the 10 minutes are up so I have no time to code it for you . . .  sorry about that.
 
RaptorUK:
I've just spent the last 10 minutes thinking of the best way to implement this type of Indicator . . .   unfortunately that means that the 10 minutes are up so I have no time to code it for you . . .  sorry about that.

Just before I go to bed . . . . try this,  I have checked that it compiles,  but not tested it . . .  you will have to do that,  if you are interested in using it . . .  let me know if it works.

 
RaptorUK:

Just before I go to bed . . . . try this,  I have checked that it compiles,  but not tested it . . .  you will have to do that,  if you are interested in using it . . .  let me know if it works.


RaptorUK

 

That is very kind of you, thank you, it works fine and is almost what I needed - I just need the output to be an actual plotted value (like a line indicator) which sits under the chart (much like what an RSI indicator looks like) that simply plots this value - no whistles and bells. I understand that the line plot will just sit there at the same value for long periods of time bar after bar until trades are entered/exited. 

 

If you find the time, is there any way you could make it plot a value rather than print the text on the chart like it currently does?

 

With much gratitude

Pinky (PS: the whole "10 minutes" thing I seem to have offended everybody with on my first post was just a figure of speech from where I come from, I didn't actually think people whip up code in literally ten minutes as if it's nothing - apologies for offence).

 
There's indicator in MetaEditor called iExposure, probably not what you looking for, but you can at least try and give opinion. 
 
pinky:


RaptorUK

 That is very kind of you, thank you, it works fine and is almost what I needed - I just need the output to be an actual plotted value (like a line indicator) which sits under the chart (much like what an RSI indicator looks like) that simply plots this value - no whistles and bells. I understand that the line plot will just sit there at the same value for long periods of time bar after bar until trades are entered/exited. 

 

If you find the time, is there any way you could make it plot a value rather than print the text on the chart like it currently does?

Ah I see,  you want a line in a separate window . . .  lets see what I can do.
 
RaptorUK:
Ah I see,  you want a line in a separate window . . .  lets see what I can do.

Try this,  I have tested it a little using made up order numbers . . .  seems to work.

Files:
 
RaptorUK:

Try this,  I have tested it a little using made up order numbers . . .  seems to work.

 


Thanks for your suggestion phi.nuts I have seen that before but it's not the thing I needed, thanks anyway for replying.

 

And RaptorUK many thanks for looking again at this - I'm stuck at work now all day (!) so I cannot test it until tonight UK time. I will give it a thorough going over and let you know the result!!

 

Really kind of you!


Pinky 

 

This indicator is a modification on iExposure telling you also number of trades your EA has made

 https://www.mql5.com/en/code/10387  There are three indicators choose the best one  ..... 

Think it is for you .....       EA Profits 1.0 

 
pinky:


Thanks for your suggestion phi.nuts I have seen that before but it's not the thing I needed, thanks anyway for replying.

 

And RaptorUK many thanks for looking again at this - I'm stuck at work now all day (!) so I cannot test it until tonight UK time. I will give it a thorough going over and let you know the result!!

 

Really kind of you!


Pinky 


deVries - thanks for suggestion but I just needed a stand alone indicator with no whilstles and bells.

 

RaptorUK - EXCELLENT!!! I've tested it and it's perfect! Many thanks!! Does exactly what it says on the tin! Seriously, I'm very grateful for your help - I guess programming language just isn't something that gels well with my brain.

 

All the best

 

Pinky 

Reason: