« Forex Trading - My First Steps | Main | My Experiments with Media Center PC (HTPC) - Introduction »
MetaTrader (MT4) Expert Advisor - How To Change Color of Moving Average Lines (SMA, EMA)
September 27, 2006
I have been doing paper trading (trading in a demo forex account) for the past couple of weeks. I am currently trying out COESfX platform SpotTrader. This is a platform that is based on MetaTrader (MT4).
MetaTrader has a feature called 'Expert Advisor'. This helps you model your trading strategy and will help in back testing the same.
When I got started with MT4 Expert Advisor, one of the problems that I faced was the following - I wanted to change the color of the Moving Average lines (SMA) that was drawn on the graph when the expert advisor executes. I can manually change the color after every run by right clicking on the line and then on "properties", but I wanted it to happen by default.
This is a problem with a simple solution, but I had to struggle to find out the solution as the documentation for MT4 Expert Advisor is not very good. The English is very poor and my guess is that it is a translation from Russian.
Anyway the solution to this problem of changing the color is to create a default template file for the strategy tester.
I did this by first running the expert advisor, manually changing the colors and then saving the template. The template should be saved as "tester.tpl"
Once the template is saved, you can go and edit the file to remove unwanted template settings. From then onwards, every time the tester is run, the template will be applied the the output graph. Given below is the template that I use for my expert advisor currently.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<chart>
scale=3
graph=0
shift_size=10
<window>
height=100
<indicator>
name=main
</indicator>
<indicator>
name=Moving Average
period=100
shift=0
method=0
apply=0
color=13850042
style=0
weight=1
period_flags=0
show_data=1
</indicator>
<indicator>
name=Moving Average
period=50
shift=0
method=0
apply=0
color=255
style=0
weight=1
period_flags=0
show_data=1
</indicator>
<indicator>
name=Moving Average
period=15
shift=0
method=0
apply=0
color=16777215
style=0
weight=1
period_flags=0
show_data=1
</indicator>
</window>
</chart>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Posted by liveit at September 27, 2006 10:05 PM
