Forum

Overmet TP After Minimum Trade Period

I want to force a minimum trade period of 1 bar. For this I did not set TP in orders but only after 1 period has passed. To find a solution for a minimum trade period has been challenging. Finally I found this: // Check if you have an opened position if ( PositionSelect ( Symbol ()) ==

Counting Buy/Long and Sell/Short Positions in MQL5

I have searched and found the code below for counting Buy/Long and Sell/Short Positions in MQL5. But it seems not to make what it should do. int countBuy = 0 ; int countSell = 0 ; for ( int i= PositionsTotal ()- 1 ; i>= 0 ; i--) { string csymbol= PositionGetSymbol