Risk Based Money Management Formula

 

Hi,

I'm trying to get a formula to calculate trade lotsizes based on stop loss and a % of the account to risk.

I know this has been asked a million times but I still can't get a formula to work. It will need to calculate the value based on conversion to the account currency. 

Best I have found so far is WHRoeder's formula:

Account Balance * percent = RISK = (OrderOpenPrice - OrderStopLoss)*DIR * OrderLots * DeltaPerlot (Note OOP-OSL includes the SPREAD) 

Where DeltaPerLot is:

double  DeltaValuePerLot(string pair=""){
    if (pair == "") pair = Symbol();
    return(  MarketInfo(pair, MODE_TICKVALUE)
           / MarketInfo(pair, MODE_TICKSIZE) ); // Not Point.
}

But what is "DIR" in the formula above???

Feel like I'm almost there with it as I think the tickvalue will convert it back to the account currency for me.

Any help much appreciated guys! 

Why is there NO Complete EA within the Code-Base? (ubzen) - MQL4 forum - Page 3
Why is there NO Complete EA within the Code-Base? (ubzen) - MQL4 forum - Page 3
  • www.mql5.com
Why is there NO Complete EA within the Code-Base? (ubzen) - MQL4 forum - Page 3