Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

MetaTrader 5 Expert Advisor | Futures Portfolio Control Expiration

The Expert Advisor demonstrates the use of functions from the Current Next Futures script, which enables automatic switch to a new futures before expiration. The EA opens a position of the appropriate volume on three instruments, which are specified in input parameters. Negative volume values are used for sell positions, positive ones are for buy positions. A few hours before the expiration of the futures (specified in hours_before_expiration), the EA closes the position and opens a new one on the new futures symbol.

Input Values

  • Symbol1 - a short name of the first symbol;
  • Symbol2 - a short name of the second symbol;
  • Symbol3 - a short name of the third symbol;
  • Lot1 - volume for the first symbol;
  • Lot2 - volume for the second symbol;
  • Lot3 - volume for the third symbol;
  • hours_before_expiration - how many hours before expiration the EA should switch to a new futures symbols.

MetaTrader Experts, Indicators, Scripts and Libraries

MetaTrader Experts, Indicators, Scripts and Libraries

Warning: The Expert Advisor has not been tested in real trading. It is designed for use in the Strategy Tester.
20453

Best MetaTrader Indicators + Profitable Expert Advisors