Maxlot indicator for mt5

 
Hi guys,

Merry Christmas to those who celebrate it. 


I would like to see whether anybody has this mt5 script as an indicator: https://www.mql5.com/en/code/18058. Exactly the same, using the entire free margin available to calculate the maximum lot size available for trading. I do not need any risk management options, stop-loss or profit-level options, etc. I need this for mt5, not for mt4. 


I would like to have this as an indicator, since it is much faster and easier to use when I have it all the time on the chart (part of the template), readily available to see. As a script, I need to drag/drop it every time I need this info; annoying... 

I can see that the code is relatively short and simple; so a conversion to an indicator is probably not very difficult or time-consuming. Unfortunately, I am not good at coding... so, just checking if somebody has already done it or can do it for fun. 

And, please, those of you who would be inclined to immediately respond to my post by saying that I should either learn to code or should contact a coder who would be happy to do it for a fee... I am well aware of these options.... There is no point to waste your time by writing anything like that... not relevant to my request. 

Thanks in advance. 


 
Changed to a EA, not indicator
Files:
MAX_LOT.mq5  22 kb
 
Li Hua Liu #:
Changed to a EA, not indicator

Thanks a lot man! Great job.

Just to let you know, I had to change the last number of this line from 4 to 2. The reason is that the lots cannot have more than 2 figures after the decimal...

if(MaxLot>0) strMaxLot="Максимальный лот для открывания позиции "+DoubleToString(MaxLot,4);

Also I changed the wording from Russian to a simple word "MaxLot", so that the line now reads like this:

if(MaxLot>0) strMaxLot="MaxLot "+DoubleToString(MaxLot,2);


As an EA it does stick to my template and it does the job great. So, thanks again.

 
Li Hua Liu #:
Changed to a EA, not indicator

Can you please convert it to an indicator?

As an EA it will not allow me to add other EA to the Chart.


Thank you

 
dallas87 #:

Can you please convert it to an indicator?

As an EA it will not allow me to add other EA to the Chart.


Thank you

why not just make another chart with the same symbol and then add the EA there

-----

long story short, do not waste your time trying to build this into an indicator as the OrderCalcMargin function won't work in indicators.


Reason: