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 10:05 PM
Forex Trading - My First Steps
During the past few weeks I have been studying foreign exchange trading (forex for short). Forex trading involves buying and selling of currencies. Forex trading is similar to stock trading in many ways but there are a few very important differences too.
In forex trading there are currency pairs, for example EURUSD - that is the Euro/USD. If you think that Euro is going to appreciate against the USD, then you buy EURUSD now and sell it later. You buy EURUSD for a price that is often quoted something like 1.2782 - This means that you need to spend 1.2782 USD for buying one Euro.
When Euro appreciates, this number will go up to say 1.2792. Now you can sell the Euro that you bought and get back more USD that you originally spent. That way you make a profit.
Now the value could have also gone against you to say 1.2772 and then you get less USD that you originally spent and thus you make a loss.
One important fact that you should be aware of is that for Forex trading, the brokers available are still now well regulated by governments and so you should be careful in choosing a broker. First of all you should go with a well known firm. The other consideration that you should be aware is that there are what are called "Dealing Desk" brokers and "Non Dealing Desk" (NDD) brokers.
Dealing desk brokers are very similar to bucket shops that operated in the early 1900s for stock trading. The problem here is that the broker does not always pass on your trade to the actual market and is in effect betting against you. And when they have all the control, it does not take much to figure out who will win the bet! So you should try to find out an reputable "Non dealing desk" broker. I am trying out COESfX with a demo account.
Posted by liveit at 8:47 PM
