No. of Lots
Hi,
Here I am trying to find out how many 0.1 (SYMBOL_VOLUME_MIN) lots are there in a position. I am using below given code to find it.
Only BUY-Instant orders are used here.
Lot Size is maintained as 0.1 while opening, adding and closing of the position.
Position Volume is working good.
But Total no of Minimum Lots keeps on varying time to time.
In practical it should match with the Position volume. But sometimes it matches and sometimes it's not.
Please help me with this. My next calculations depend on this.
Output:
Try this :
double arr_open_prices[1000] = {0}; int Maximum_Lots_Allowed = 1000; double TotalLots = 0; bool flag = true; long Position_ID; int OnInit() { return(INIT_SUCCEEDED); } void OnTradeTransaction(const MqlTradeTransaction &trans, const MqlTradeRequest &request, const MqlTradeResult &result) { if(PositionSelect(_Symbol)) { double volume=PositionGetDouble(POSITION_VOLUME); TotalLots = volume/SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN); Position_ID = PositionGetInteger(POSITION_IDENTIFIER); Print("Total no of Minimum Lots = " + TotalLots); Print("Position Volume = " + volume); Print("Symbol Minimum Volume = " + SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN)); if(HistorySelectByPosition(Position_ID)) Print("History Total = " + HistoryOrdersTotal()); Print("______________________________"); } }
Try this :
Hi,
Here I am trying to find out how many 0.1 (SYMBOL_VOLUME_MIN) lots are there in a position. I am using below given code to find it.
Only BUY-Instant orders are used here.
Lot Size is maintained as 0.1 while opening, adding and closing of the position.
Position Volume is working good.
But Total no of Minimum Lots keeps on varying time to time.
In practical it should match with the Position volume. But sometimes it matches and sometimes it's not.
Please help me with this. My next calculations depend on this.
Output: