madopter: Dear coders, is there an easy way to increase the lot size based on balance? For example, let's say I want to trade lot 1 for every 10000 units of balance, or if I want to do 0.02 for every 1000 units of balance? Which parameters would I need and what would be the code?

In the first example, I would be in lot 1 for 10000 <= balance <= 19000, and lot 2 for 20000 <= balance <= 29000, etc.

Thank you.

You can do that like this

double lots=5; // or whatever maximal lot size you chose

double lots=5; // or whatever maximal lot size you chose

while (true)

{

if (AccountBalance()<19000) { lots = 1; break; }

if (AccountBalance()<29000) { lots = 2; break; }

if (AccountBalance()<39000) { lots = 3; break; }

//

//

// futher comparisons here in ascending order

//

//

break;

}

Thank you mladen, this would do the job. Do you think one can construct an algebraic expression so that the amounts aren't hardcoded? I think it might be doable with two parameters?

madopter: Thank you mladen, this would do the job. Do you think one can construct an algebraic expression so that the amounts aren't hardcoded? I think it might be doable with two parameters?

Hi. I'm trying to alter the 3 Ducks indicator from using moving averages, to using the ADX indicator. With an input value of '2'. All is well until I compile my efforts....then this is what I Get in the 'Description box!

mladen: What parts of that code would you like to be adjustable?

The adjustable parts should be the lot size, and the account balance to which the lot is applied to. For example, the parameters might be A = 0.01, B = $5000, or, A = 1.00, B = $10000.

Jeeves: Hi. I'm trying to alter the 3 Ducks indicator from using moving averages, to using the ADX indicator. With an input value of '2'. All is well until I compile my efforts....then this is what I Get in the 'Description box!

//h1 data

double h1adx = iADX(NULL,PERIOD_H1,2,);

//h4 data

double h4adx = iADX(NULL,PERIOD_H4,2);

//d1 data

double d1adx = iADX(NULL,PERIOD_D1,2);

The three line of coding above are tagged as :

')' - syntax error, parameter missed

Could some kind soul put them right for me?

Jeeves

You are missing parameters for iADX() call. One example would be this (to get the value of the ADX itself) :

I have found nice scalping system and template but it runs so slowly after installing this system. Maybe someone is able to look it and detect what could cause it.

madopter:Dear coders, is there an easy way to increase the lot size based on balance? For example, let's say I want to trade lot 1 for every 10000 units of balance, or if I want to do 0.02 for every 1000 units of balance? Which parameters would I need and what would be the code?

In the first example, I would be in lot 1 for 10000 <= balance <= 19000, and lot 2 for 20000 <= balance <= 29000, etc.

Thank you.You can do that like this

while (true)

{

if (AccountBalance()<19000) { lots = 1; break; }

if (AccountBalance()<29000) { lots = 2; break; }

if (AccountBalance()<39000) { lots = 3; break; }

//

//

// futher comparisons here in ascending order

//

//

break;

}

mladen:You can do that like this

while (true)

{

if (AccountBalance()<19000) { lots = 1; break; }

if (AccountBalance()<29000) { lots = 2; break; }

if (AccountBalance()<39000) { lots = 3; break; }

//

//

// futher comparisons here in ascending order

//

//

break;

}

Thank you mladen, this would do the job. Do you think one can construct an algebraic expression so that the amounts aren't hardcoded? I think it might be doable with two parameters?

madopter:Thank you mladen, this would do the job. Do you think one can construct an algebraic expression so that the amounts aren't hardcoded? I think it might be doable with two parameters?

Yes, why not ...

That would make it flexible to use

mladen:Yes, why not ... That would make it flexible to use

I can't figure out how to do it but I haven't spent a ton of time trying to figure it out. If it's obvious to you, please let me know

madopter:I can't figure out how to do it but I haven't spent a ton of time trying to figure it out. If it's obvious to you, please let me know

What parts of that code would you like to be adjustable?

Hi. I'm trying to alter the 3 Ducks indicator from using moving averages, to using the ADX indicator. With an input value of '2'. All is well until I compile my efforts....then this is what I Get in the 'Description box!

//h1 datadouble h1adx = iADX(NULL,PERIOD_H1,2,);

//h4 data

double h4adx = iADX(NULL,PERIOD_H4,2);

//d1 data

double d1adx = iADX(NULL,PERIOD_D1,2);

The three line of coding above are tagged as :

')' - syntax error, parameter missedCould some kind soul put them right for me?

mladen:What parts of that code would you like to be adjustable?

The adjustable parts should be the lot size, and the account balance to which the lot is applied to. For example, the parameters might be A = 0.01, B = $5000, or, A = 1.00, B = $10000.

Jeeves:Hi. I'm trying to alter the 3 Ducks indicator from using moving averages, to using the ADX indicator. With an input value of '2'. All is well until I compile my efforts....then this is what I Get in the 'Description box!

//h1 datadouble h1adx = iADX(NULL,PERIOD_H1,2,);

//h4 data

double h4adx = iADX(NULL,PERIOD_H4,2);

//d1 data

double d1adx = iADX(NULL,PERIOD_D1,2);

The three line of coding above are tagged as :

Could some kind soul put them right for me?')' - syntax error, parameter missedJeeves

You are missing parameters for iADX() call. One example would be this (to get the value of the ADX itself) :

double h4adx = iADX(NULL,PERIOD_H4,adxPeriod,adxPrice,MODE_MAIN,2);

If you want to get the value of +DI replace the MODE_MAIN with MODE_PLUSDI, and in the case of -DI replace that with MODE_MINUSDI

Also, replace adxPeriod and adxPrice with desired values

Many, many thanks. Appreciate the help.

Template runs slowly

I have found nice scalping system and template but it runs so slowly after installing this system. Maybe someone is able to look it and detect what could cause it.

Template and indicators:

1m_alf_scalp.zip

Files: