Download MetaTrader 5

expert adviser working on several chart at the same time - page 2

To add comments, please log in or register
whroeder1
14756
whroeder1 2014.04.25 20:04  
3056527: I don't want the computer on or on sleepstand all the time.
Must be active for the EA to do anything. Get a VPS and run it there.
796790
91
796790 2014.04.26 15:56  

Thanks WHRoeder for your suggestion.

But i would like to know how to set the buylevel when starting up.

I have the following code but this will give the orderprice of the first(highest) order When i have several orders).

But i need to get the last (lowest) orderprice.

void startlevel ()
{
int      lastTicket = -1;
for(int i = OrdersTotal()-1;i >= 0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))                                 
if(OrderMagicNumber()==magicnumber)                                           
if (OrderSymbol()==Symbol())                                                 
if(OrderType()==OP_BUY)   
                                                   
buylevel = (OrderOpenPrice());
Alert(buylevel);

Need some help whit this.

796790
91
796790 2014.04.26 16:39  

Solved my prblem with buylevel.

Check code.

void startlevel ()
{

for(int i = 1;i<=OrdersTotal();i++)
{
if(OrderSelect(i-1,SELECT_BY_POS,MODE_TRADES)==true)                                 
if(OrderMagicNumber()==magicnumber)                                           
if (OrderSymbol()==Symbol())                                                 
if(OrderType()==OP_BUY)   
                                                   
buylevel = (OrderOpenPrice());
Alert(buylevel);
12
To add comments, please log in or register