Hello, dear community members!
I ask experienced participants to help in the following – I want to add a setting to the expert Advisor that will allow it to make only short or only long trades, or both. In MT4, there is such an option when attaching an expert Advisor in the input parameters,but in MT5 it is not. I will be very grateful for your help!
barabashkakvn
Alternatively, you can implement it via Transfers.
Sample code: PSI iMA iStochastic
An enum is declared:
//+------------------------------------------------------------------+
//| Enum Trade |
//+------------------------------------------------------------------+
enum ENUM_TRADE
{
buy=0, // Only BUY
sell=1, // Only SELL
all=2, // BUY and SELL
};
And in the input parameters we specify the restriction:
input ENUM_TRADE InpTrade=all; // Type trade:
– in this case, the option is selected: “you Can BUY and SELL”.
And already inside the code, the expert Advisor looks at the inptrade variable when generating a signal and decides whether to skip such a signal or not.