# how to set the lot size as a formula [Deleted]

I have an EA that I am working on and it uses simple inputs:

extern double Lots = 0.1;

extern double StopLoss = 20;

extern double TakeProfit = 15;

extern int Slippage = 3;

What I wish to do is set the lot size to be a formula including the current value of an indicator - ADX for example. ADX has +DI and -DI. What I am trying to do is set this to work like this:

- if the EA is going to go long the lot size will be calculated 2* +DI value of ADX

-if the EA is going to go short the lot will be 2* -DI value of ADX

Can anyone let me know how this can be done?

Much appreciated! 651

blank_jack:

I have an EA that I am working on and it uses simple inputs:

extern double Lots = 0.1;

extern double StopLoss = 20;

extern double TakeProfit = 15;

extern int Slippage = 3;

What I wish to do is set the lot size to be a formula including the current value of an indicator - ADX for example. ADX has +DI and -DI. What I am trying to do is set this to work like this:

- if the EA is going to go long the lot size will be calculated 2* +DI value of ADX

-if the EA is going to go short the lot will be 2* -DI value of ADX

Can anyone let me know how this can be done?

Much appreciated!

hey

i'm not sure what are you asking about, because you wrote algorithm for calculating lot size (and the rest should be easy). You can do this like that:

```if (conditions for buy)

{

Lots=NormalizeDouble(2*DI,2);