Correct calculation of the lot from the % of the deposit - page 4

 

Thank you all for your help and participation... Here is the result of my "suffering".

double lotSize(double deposSize=1000.0, string currName="USDCHF", double proc=2.0, int pipsLoss=1000)

{

double currMove=deposSize*proc/100;// расчет процента от величины, предположительно, депозита

double lotCount=currMove/(pipsLoss*MarketInfo(currName,MODE_TICKVALUE));//ну а тут и ведеться сам расчет лота

if(lotCount<MarketInfo(currName,MODE_MINLOT))

{

return MarketInfo(currName,MODE_MINLOT);

}

return NormalizeDouble(lotCount,2);

//return lotCount;

}

It doesn't seem too hard, but I couldn't have done it without advice.

 

double lotCount=currMove/(pipsLoss*MarketInfo(currName,MODE_TICKVALUE));//then the lot calculation itself is performed

this is as cool as it gets ... and now counting

double currMove=deposSize*proc/100 = 1*100/100 = 1; we have 1 quid

currName = "EURUSD"

MarketInfo(currName,MODE_TICKVALUE) = 0.1 for five digit quotes

pipsLoss = 1000

in total we have

double lotCount=currMove/(pipsLoss*MarketInfo(currName,MODE_TICKVALUE)) = 1 /(1000*0.1) = 0.01

everything seems fine(margin is 68.53 per lot), if pipsLoss = 100, then lotCount = 0.1, but there is not enough margin for it - for 0.1 we need 6.853, and we have 1 quid...

and on the other hand, in the first case, having 1 quid and an opening with a stop of 1000 points will be left with 0.31 of a quid

i wonder if this is enough money for an order with a stop-loss of 1000 pips to survive a drawdown of 999 pips i doubt it will happen,

i.e. the price of 1 pip at 0.01 lot will be 0.001, 0.31/0.001 = 310 pips, i.e. if we lose 310 pips the order will be closed by a stopout (this is if the stopout is at 0% which is wrong because it is always bigger, which means the order will close earlier), thus all the calculations are worthless since they do not help us correctly calculate the correct lot for the given conditions so the order would work correctly by a stop loss

 
double CalcLotSize(double Lot,double lRisk,int lSL=0)
  {
   string lSymbol=Symbol();
   double dLotMin    = MarketInfo(lSymbol, MODE_MINLOT        );
   double dLotMax    = MarketInfo(lSymbol, MODE_MAXLOT        );
   double dLotStep   = MarketInfo(lSymbol, MODE_LOTSTEP       );


   double dLot=Lot;

   if(lRisk>0)
     {
      if(lSL>0)
        {
         double dLotCost=MarketInfo(lSymbol,MODE_TICKVALUE);
         dLot=MathRound(AccountFreeMargin()*lRisk*0.01/(lSL*dLotCost*dLotStep))*dLotStep;
        }
      else
        {
         double dLotMargin=MarketInfo(lSymbol,MODE_MARGINREQUIRED);
         dLot=MathRound(AccountFreeMargin()*lRisk *0.01/(dLotMargin*dLotStep))*dLotStep;

        }
     }

   if(dLot<dLotMin) dLot=dLotMin;

   if(dLot>dLotMax) dLot=dLotMax;

   return(dLot);
  }
 

it seems that all the ideas of counting the lot grow from the same place and are as similar as mushrooms after the rain... (I'm criticizing myself...)

You'd better use your head to figure out what the lot calculation function should count and what it should take into account, because the proposed options do not stand up to criticism...

 

Let me explain for those who are very gifted... currMove - this is the value in money of the percentage lost when passing pipLots pips (2% of the deposit for 1000 quid at a stroke of 1000 pips (5 digits) will be $20) ...

this is as good as it gets... now do the math

double currMove=deposSize*proc/100 = 1*100/100 = 1; we have 1 quid

that is, if someone has a 1-buck loss under these conditions, then I can only admire the trader's extreme - in this case he has 50 quid worth of deposits... If someone gets 1 buck in a losing condition, then I can only admire the trader's extremalism - in that case he has a deposit of 50 bucks...

I think the following discussion of the text of the post is pointless... Because it is disrespectful to argue with trolls, and inattentive as they are.

I'm honoured.

 
gochu:

Let me explain for those who are very gifted... currMove - this is the value in money of the percentage lost when passing pipLots points (2% of the deposit for 1000 quid at a stroke of 1000 pips (5 digits) will be $20) ...

this is as cool as it gets... now do the math

double currMove=deposSize*proc/100 = 1*100/100 = 1; we have 1 quid

that is, if someone has a 1-buck loss under these conditions, then I can only admire the trader's extreme - in this case he has 50 quid worth of deposits... If someone gets 1 buck in a losing condition, then I can only admire the trader's extremalism - in that case he has a deposit of 50 bucks...

I think the following discussion of the text of the post is pointless... Because it is disrespectful to discuss with trolls, and inattentive as they are.

Honour.

double currMove=deposSize*proc/100 = 1*100/100 =1 generally means that the deposit is $1, not $50 (and has a 100% loss)

:-)

 
EverAlex:
double currMove=deposSize*proc/100 = 1*100/100 =1 generally means that the deposit is $1, not $50 (and there is a 100% loss)

well.... with a deposit like this, godspeed!

 

Vinin:

double CalcLotSize(double Lot,double lRisk,int lSL=0)


what is the Lot for ?

and how is iSL measured (I think it was about trading symbol points above)?

...(lSL*dLotCost*dLotStep))*dLotStep; means that it is not in points of the trading symbol (MODE_POINT), but in LOTSTEPs ?

or what ?
 
EverAlex:

what is the Lot for ?

and what is iSL measured in (I think it was talking about trading symbol points above)?

...(lSL*dLotCost*dLotStep))*dLotStep; means that it is not in points of the trading symbol (MODE_POINT), but in LOTSTEPs ?

or what?

This is the calculation of risk-adjusted lot. How much of the deposit you will lose when the stop is triggered
 
Vinin:

This is the calculation of the lot taking into account the risk. What part of the deposit will be lost when the stop is triggered

Therefore lSL is how many points to SL

Point = 0.00001 (on 5-digit quotes)

dLotStep = 0.01


The formula (lSL*dLotCost*dLotStep))*dLotStep is ok

It should be something like ( lSL*dLotCost*Point))*dLotStep