Amsterdam
Posts: 3 since Oct 2014
Thanks Given: 1
Thanks Received: 0
|
Hi all,
I'm currently working on my first automated strategy and I'm having some problems with the following;
When the EMA is equal to the entry price --> Close position at market.
Im currently using the following coding, but I cant figure out why it doesn't work. Note that I don't get a coding error, but when I use the strategy analyser, the position is closed out on a different spot.
if (EMA(100)[0] == Position.AvgPrice);
{
ExitShort(0, 30000, "ExitEMAShort", "");
}
As you can see in the attached picture, the position is closed out only a few bars after the entry while the EMA is not near the entry price and I can't figure out why it closes the position at this specific price.
Could anyone help me out with this?
Thanks in advance!
Dennis
|