it's stating error: failed exchange buy 47.5321 EURUSD at 1.05232 [Invalid volume]
what am I doing wrong to get the correct pips for 50% of my equity?
Thanks.
Using this function:
{
double volume_step=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_STEP);
int ratio=(int)MathRound(volume/volume_step);
return ratio*volume_step;
}
And this:
It's stating not enough money, what's wrong?
Using this function:
{
double volume_step=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_STEP);
int ratio=(int)MathRound(volume/volume_step);
return ratio*volume_step;
}
And this:
It's stating not enough money, what's wrong?
The volume is expressed in lot, not in dollars, euros, or pounds.
1 standard lot if 100,000 unit (whatever the currency).
The volume is expressed in lot, not in dollars, euros, or pounds.
1 standard lot if 100,000 unit (whatever the currency).
Thanks for the link. Working correctly now. :)
Thanks for the link. Working correctly now. :)
No, it's not working correctly, it works about right when currency is around the 1.0 mark but when for example AUDJPY at around 85.0 then it's too low.
Here's what I currently have:
double volume = VolumeValue(((AccountInfoDouble(ACCOUNT_MARGIN_FREE)) * 0.5 / SymbolInfoDouble(_Symbol,SYMBOL_TRADE_CONTRACT_SIZE)) * AccountInfoInteger(ACCOUNT_LEVERAGE) / SymbolInfoDouble(_Symbol,SYMBOL_ASK));
Please help me out here because I can't work this out.
double lot = 1.0 * SymbolInfoDouble(_Symbol,SYMBOL_TRADE_CONTRACT_SIZE) / AccountInfoInteger(ACCOUNT_LEVERAGE); double volume =AccountInfoDouble(ACCOUNT_MARGIN_FREE) * 0.5 / lot;
Seems to be near it.
- You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
- Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the SPREAD, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
- Do NOT use TickValue by itself - DeltaPerLot
- You must normalize lots
properly and check against min and max.
- You must also check FreeMargin to avoid stop out
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm new to EA's.
I've decided which to open, buy/sell.
How do I only open at 50% of my equity?
I'm guessing Equity * 0.5.
But that does not get me the amount of pips.
Thanks.