I did not compile or test this:
double getLowestLots(){ double lowestLots = 0; for(int i = 0; i < PositionsTotal(); i++){ ulong ticket = PositionGetTicket(i); if(PositionSelectByTicket(ticket)){ if(PositionGetInteger(POSITION_MAGIC) == InpMagicNumber){ if(lowestLots == 0) lowestLots = PositionGetDouble(POSITION_VOLUME); else lowestLots = MathMin(lowestLots, PositionGetDouble(POSITION_VOLUME)); } } } return lowestLots; }
there's a function from the CSymbolInfo library
#include <Trade/Trade.mqh> #include <Trade/SymbolInfo.mqh> CTrade trade; CSymbolInfo m_symbol; if (!m_symbol.Name(Symbol()) || !m_symbol.Refresh()){ Print("Failed to select or refresh symbol information for ", Symbol()); } double lotSizeMin = m_symbol.LotsMin();

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello. I have a program that opens a position with a higher lot size if there's a position open and it aims to multiply based on the lowest lot size but I'm having trouble getting the lowest lotsize. Please help