Many traders draw support and resistance lines in Metatrader charts and trade when prices breach those levels. We can automate these trades with Trading SM.
Let’s draw support and resistance lines and give them some easy to remember name.
The Line Price question of the Misc panel retrieves a line price. The question requires the line name and the bar from which we want to know the price.
You may find useless the bar number in horizontal lines but it makes sense for trend lines. The question works with both type of lines.
We are going to automate the following strategy:
- Long Condition 1: Buy Orders Open equal 0
- Long Condition 2: Bid price less than Support line in bar 0.
- Close Sell
- Short Condition 1: Sell Orders Open equal 0
- Short Condition 2: Bid price greater than Resistance line in bar 0.
- Close Buy
In the next short video, I show you how I create this robot.
Note the importance of Condition 1 in each rule. Without this condition, the Expert Advisor will keep opening orders whilst prices site above support line or below resistance line.