Download MetaTrader 5
To add comments, please log in or register
Follow the news. View our company's official channel!
18081961
678
18081961 2014.05.09 16:26 

Hi deVries and WHRoeder,

Thank you for your prompt response. Follow is last post updated.

I have an issue with the open of an order,

I want open an order every time the Bid moves by a certain value. So If I make use of ;

Global Variables

double Spread,StopLevel,FreezeLevel,RiskAmount;
double BuyTrigger,SellTrigger,TickValue,TotalOrderProfit,LotSize;
double  pips2dbl;
int BuyTicket,SellTicket,ErrorCode,orders,TotalTrades;
int  pips2points,pips,i,GLError; 
double price = 0;

int start();
if(price == 0 || Bid < price)   
   {
    price = Bid;
   }
   else
   if((Bid - price)/Point >= PriceStep)     
     {//5       
                 RefreshRates();                               
       BuyTicket = OrderSend(Symbol(),OP_BUY,LotSize,Ask,Slippage*pips2points,0,0,"Initial Buy Order",MagicNumber,0,Green);
       price = Bid;
       if(BuyTicket > -1)  

With the above the order do not open when Bid moves by PriceStep. If I modify the code as follow;

if(Bid == 0 || Bid < price)   
   {
    price = Bid;
   }
   else
   if((Bid - price)/Point >= PriceStep)     
     {//5       
                 RefreshRates();                               
       BuyTicket = OrderSend(Symbol(),OP_BUY,LotSize,Ask,Slippage*pips2points,0,0,"Initial Buy Order",MagicNumber,0,Green);
       price = Bid;
       if(BuyTicket > -1)  

As soon the ea starts and order will open no matter the PriceStep value.

Could anyone clarify me where I'm wrong ?

Thank you in advance

Luis

Tjipke de Vries
6281
Tjipke de Vries 2014.05.09 19:17  
luisneves:

Hi all,

I have an issue with the open of an order,

I want open an order every time the Bid moves by a certain value. So If I make use of

With the above the order do not open when Bid moves by PriceStep. If I modify the code as follow;

As soon the ea starts and order will open no matter the PriceStep value.

Could anyone clarify me where I'm wrong ?

Thank you in advance

Luis


check your posting we can not see a change in the modified code

we see two times

if(Bid == 0 || Bid < price)   
   {
    price = Bid;
   }
   else
   if((Bid - price)/Point >= PriceStep)     
     {//5       
                 RefreshRates();                               
       BuyTicket = OrderSend(Symbol(),OP_BUY,LotSize,Ask,Slippage*pips2points,0,0,"Initial Buy Order",MagicNumber,0,Green);
       price = Bid;
       if(BuyTicket > -1)  

so your posting has to be wrong

whroeder1
13637
whroeder1 2014.05.10 13:24  
luisneves: I want open an order every time the Bid moves by a certain value. So If I make use of
 int init ()
Init is only called once, bid will never move
/
To add comments, please log in or register