Download MetaTrader 5
To add comments, please log in or register
Sell your applications via the Market. It is secure!
Tradeing Trader
Tradeing Trader 2013.12.07 16:16 


i have codeing for myself a simple Lotsize calculation and it work good, but i think when i use other symbols like gold then this will give to much lotsize, because i dont have a pipvalue in my calculation, my calculation will give for every symbol same lotsize, can somebody helpt me to make my lotsize function better, that is calculate for every symbol the right risk percent lotsize?

Here is my current code:

    double Percent=RiskPercent;
    double AllowedLoose=(AccountEquity()/100)*Percent;
    double Lots=NormalizeDouble((AllowedLoose/Stoploss)/10,2);
whroeder1 2013.12.07 16:53  

Account Balance * percent = Risk = (orderOpenPrice - OrderClosePrice)*DIR * DeltaPerLot * OrderLots

  1. 10 is valid only for EURUSD on a USD account. Do it right
  2. Risk/stoploss is ignoring the spread.
  3. NormalizeDouble assumes lotstep = 0.01 do it right never use NormalizeDouble, ever.
  4. You must also verify that you have enough free margin (to open) and at most adverse excursion (mae) of ALL open orders to prevent margin call (stop out). See my lotsize code
Tradeing Trader
Tradeing Trader 2013.12.07 17:37  

Hello, can you please modify my function that it work right on all pairs or can you show me a function from you wich work right?

I have not see in your link such a function, but many different thinks.

To add comments, please log in or register