Long Rule: Actions

Now that we have defined the Long Rule with its conditions, it is time to associate the trading actions triggered by this rule. This is a rule that changes the trading scenario based on our strategy. So, at the moment this rule is met by its conditions, we need to clean any orders open from the opposite scenario (Short). For this purpose, the first action that we associate to this rule is the Close Sell orders.

 

This action does not require any settings but in case you need to specify any you can use the Trading SM reference to see what can be customized in each action.

After closing all Sell orders, we want to open a Buy order. The action that will do this is Buy. In this action, we need to specify the trading volume for the new order. So, we need to first create a parameter that will hold the trading volume.

 

Note that we have marked the parameter as external. That way, we can modify the trading volume from the Metatrader terminal every time we run the Expert Advisor.

Finally, we can associate the Buy action to the Long Rule.