Require some advice in EA coding

 

Hello friends this is checkmail and am still learning to code the EA, am interested in the lot assignment code.

if (Volume[0] <= 1.0)

if (FreeMargin() < 1000.0 * Lots)

OR

if (Volume[0] <= 0.1)

if (FreeMargin() < 10.0 * Lots)

Are the above stated codes correct, one is with big capital and the second one is for the small capital.

Will this both code work properly.Need some advice from the experts.

For example one account with $2000 and another one with $ 20.

 
Volume() is Integer and couldn't be less then 1
 
Roger:
Volume() is Integer and couldn't be less then 1


So how will it be possible to an $20 account or its impossible, got your point volume is int, requires an double.

can you code it to me, in both type of accounts $2000 and $20

 
Volume have Nothing to do with money management if that's what you're looking for. Volume should mean active traders. Those who know better, please excuse my narrow definition of Volume.
 
ubzen:
Volume have Nothing to do with money management if that's what you're looking for. Volume should mean active traders. Those who know better, please excuse my narrow definition of Volume.


So the only thing matters is the lots, means the minimum avail margin to trade in order to open an trade.

only this code is imp : if (FreeMargin() < 1000.0 * Lots) for $ 2000.00 Account

or

if (FreeMargin() < 10.0 * Lots) for $ 20.00 Account

 

If minimum lots = 0.1. then  if (FreeMargin() < 1000.0 * Lots) would mean "Do if I have Less than $100.00 in free margin.". What are you looking to do? Find Lot size? or Give a Warning?

 
ubzen:

If minimum lots = 0.1. then if (FreeMargin() < 1000.0 * Lots) would mean "Do if I have Less than $100.00 in free margin.". What are you looking to do? Find Lot size? or Give a Warning?


ok not in coding but an straight question and expect an straight answer.

here in the above code its volume given which you say it isn't of imp to allot lot size.

so in the next line of the free margin code it will be an variable/multiple of the minimum lot avail in the terminal.

If our 0.1 lot in mt4 terminal = $1.00 than in big account we need atleast $2000 to trade with <1000.0 and

if our 0.1 lot in mt4 terminal = $1.00 than in small account we need atleast $10 t trade with <10.0.

Would it be right thing ?

 

If our 0.1 lot in mt4 terminal = $1.00 than in big account we need atleast $2000 to trade with <1000.0 and
if our 0.1 lot in mt4 terminal = $1.00 than in small account we need atleast $10 t trade with <10.0.

<1000.0 and <10.0. What does that represent for you? Lot Size, Percentage or Money$? 

 
ubzen:

If our 0.1 lot in mt4 terminal = $1.00 than in big account we need atleast $2000 to trade with <1000.0 and
if our 0.1 lot in mt4 terminal = $1.00 than in small account we need atleast $10 t trade with <10.0.

<1000.0 and <10.0. What does that represent for you? Lot Size, Percentage or Money$?


According to your advice and explanation am understanding it as the quantity to be multiplied by the lot size.

the above $ calculation was based on 0.1 lot = $1.00.

But do the EA describes VOLUME as the lot size ?

Means can we code the EA, our minimum lot size which might be higher than the terminal minimum lot size ?

 

No Volume does Not mean Minimum Lot size. Volume in Forex is the number of Tick which happens within a time period. Example 5-minutes chart and 1-Hour charts. Obviously or usually there would be more ticks within 1-Hour charts compared to 5-Minutes therefore, higher Volume on H1. If you see a volume of 1000 that does not mean you're trading at 1000 lots minimum. People use Volume to figure out if there's allot of activity going on in the marker at the time. 

 

FreeMargin return the amount of Free Margin you have in Dollars. I could be wrong about some of this because I don't have it all rapped-up in my head. But, how I understand it. If you had $2000, there's no way in Heaven you'd be able to trade with 1000.0 Lots without getting a margin rejection. Highest Lots most brokers offer is usually 50.0 before they start to kick you out of the little boys club.

 

Anyway, textbook margin is 100 to 1. So if you wanna beat 1$ then you should have 100$ to support it. So if your account drops by 1 pip/point the broker will give you the Margin Call and Close your position because now have only 99$ and not 100$. Again, if someone who better understand could elaborate on my simple definition if it's wrong I'll appreciate it. 

 
ubzen:

No Volume does Not mean Minimum Lot size. Volume in Forex is the number of Tick which happens within a time period. Example 5-minutes chart and 1-Hour charts. Obviously or usually there would be more ticks within 1-Hour charts compared to 5-Minutes therefore, higher Volume on H1. If you see a volume of 1000 that does not mean you're trading at 1000 lots minimum. People use Volume to figure out if there's allot of activity going on in the marker at the time.

FreeMargin return the amount of Free Margin you have in Dollars. I could be wrong about some of this because I don't have it all rapped-up in my head. But, how I understand it. If you had $2000, there's no way in Heaven you'd be able to trade with 1000.0 Lots without getting a margin rejection. Highest Lots most brokers offer is usually 50.0 before they start to kick you out of the little boys club.

Anyway, textbook margin is 100 to 1. So if you wanna beat 1$ then you should have 100$ to support it. So if your account drops by 1 pip/point the broker will give you the Margin Call and Close your position because now have only 99$ and not 100$. Again, if someone who better understand could elaborate on my simple definition if it's wrong I'll appreciate it.


Hello got you point regarding tick, but what am trying to ask was that can we code our EA to dig more below the textbook 100 margin and

Means in case am having $50 can we apply it to our EA it would be (50 to 1) or (10 to 1).Let the highest remain, will ask later.

Reason: