Download MetaTrader 5
To add comments, please log in or register
Publish your task in Freelance service and developers will execute your order.
tbm
27
tbm 2014.06.20 10:11 

Hi All,

I am new to coding (never done this before) but want to realize my own trading strategy.

The system should send a buy order each bar (at open price) for a number of periods that is equal to an moving average used. After this the EA should close the first (oldest) order in the next period ans simultaniously open anthoter one.

Example: Lets say we use a MA(5), now the following should happen:

Period 1  -> send 1 buy order at open price                                        What the EA does instead: send 1 buy order at open price

Period 2  -> send 2 buy order at open price        What the EA does instead: send 2 buy order at open price

Period 3  -> send 3 buy order at open price       What the EA does instead: send 3 buy order at open price

Period 4  -> send 4 buy order at open price       What the EA does instead: send 4 buy order at open price

Period 5  -> send 5 buy order at open price               What the EA does instead: send 5 buy order at open price

Period 6  -> close 1 buy order and open 6 buy order at open price       What the EA does instead: close 1 buy order at open price

Period 7  -> close 2 buy order and open 7 buy order at open price       What the EA does instead: send 6 buy order at open price

Period 8  -> close 3 buy order and open 8 buy order at open price       What the EA does instead: close 2 buy order at open price

Period 9  -> close 4 buy order and open 9 buy order at open price       What the EA does instead: send 7 buy order at open price 

... 

 

Could anybody help me to fix this?? I realy don't understand whats wrong there. Thanks very much in advance for your help guys. I've attachted the EA below 

 

With best regards,

tbm 

Files:
qjol
3243
qjol 2014.06.20 13:59  

using volume to trade the first tick isn't reliable use time instead

/
To add comments, please log in or register