- Account Balance * percent = RISK = (OrderOpenPrice - OrderStopLoss)*DIR * OrderLots * DeltaPerlot (Note OOP-OSL includes the SPREAD)
- Do NOT use TickValue by itself - DeltaPerlot
- You must also check FreeMargin to avoid stop out
double Spread=MarketInfo(Symbol(),MODE_SPREAD)/Q; double Risk=(RiskPercent*AccountEquity())/100;//this means if your balance 1000$ & RiskPercent=10% >> you going to risk 100$ double lot=Risk/((StopLoss+Spread)*MarketInfo(Symbol(),MODE_TICKVALUE)*Q);//Make Sure to Define Your StopLoss & Q=10 in 5 digits or Q=1 in 4 Digits
Sorry its not good
- Account Balance * percent = RISK = (OrderOpenPrice - OrderStopLoss)*DIR * OrderLots * DeltaPerlot (Note OOP-OSL includes the SPREAD)
- Do NOT use TickValue by itself - DeltaPerlot
- You must also check FreeMargin to avoid stop out
Ok i see your point, so here is my logic and calculation how i calculate the RISK %
Which in MQL4 code looks like this:
extern double MYSTOPLOSS = 50; // CUSTOM SL SIZE IN PIPS AFTER THE STOPLEVEL extern double RISK =2; // 2% ACCOUNT RISK double LOT =(AccountEquity()*RISK)/(100*(MarketInfo(Symbol(),MODE_STOPLEVEL)+MYSTOPLOSS)* Point *100000 );
A simple 1 liner, nothing complicated, now please help me insert that DELTA stuff that you have been talking about, i know the formula is not complete so please help me.And please note that my account is in EURO so in most cases its the basic currency.
- now please help me insert that DELTA stuffDid you bother to click on the links provided?
- now please help me insert that DELTA stuffDid you bother to click on the links provided?
Yes i did, but i dont understand how you fit that into my equation, you said you need this:
MarketInfo(pair, MODE_TICKVALUE) / MarketInfo(pair, MODE_TICKSIZE)But i dont understand how this helps my equation, because dividing these two numbers will give a big number instead of the ticksize...
Yes i did, but i dont understand how you fit that into my equation, you said you need this:
But i dont understand how this helps my equation, because dividing these two numbers will give a big number instead of the ticksize...Try this link: https://www.mql5.com/en/forum/148224.
Perhaps looking at it from a different angle might help.
Try this link: https://www.mql5.com/en/forum/148224.
Perhaps looking at it from a different angle might help.
WTF guys, shouldnt that be TICKVALUE * TICKSIZE instead of TICKVALUE /TICKSIZE ? I think there is a big mistake there
Just made a quick indicator which shows separate values, i guess the TICKVALUE * TICKSIZE is the appropriate one...
And note the demo account is in EUR so that is the base currency, while i did the same test with a USD account and there the POINT was equivalent to TICKVALUE * TICKSIZE because it measures the quote currency value.
If i have understand the question right this will do the job for you.
for( i=0; i<=ot; i++ ) for( z=0; z<=10; z++ ) { if( long_orders_array_ATF[i][z] > 0 ) for (zz=0; zz<=10; zz++) { OrderSelect(zz,SELECT_BY_POS,MODE_TRADES); if (OrderTicket()==long_orders_array_ATF[i][z]) zz=ot+2; if (ot+2<=zz) long_potencial_loss = (OrderLots() * (OrderOpenPrice() - OrderStopLoss()))*100000; long_sum_potencial_loss = long_sum_potencial_loss + long_potencial_loss; } } ... lot_size = ((((free-long_sum_potencial_loss) * percent_depo)/100.0)/pips)/100000 ; }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, i please need a code/ formula which resizes the lot size based on Account Risk % calculated by including the STOPLOSS, and taking in consideration that my account is in EUR.
What i have is this:
But this one doesnt consider the stoploss
So i found this one on google search
And this one
But none of this works, please help me fix them, or give me a better one, thanks!