how to disable either short or long positions on mt5 EA

 

Good day

l have made an EA on mt5 which uses the crossover of fast and slow moving averages to enter both long and short positions. l want to be in a position to disable the long position when lam entering a sell and disable a short position when lam entering a buy, using the long_allowed and short_allowed bool inputs.  below is my code

Discover new MetaTrader 5 opportunities with MQL5 community and services
Discover new MetaTrader 5 opportunities with MQL5 community and services
  • www.mql5.com
MQL5: language of trade strategies built-in the MetaTrader 5 Trading Platform, allows writing your own trading robots, technical indicators, scripts and libraries of functions
 

You just generated an Expert Advisor in the MQL5 Wizard.

If you need an individual strategy, you need to write your own code.