Ea should open after bid move

 

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

 
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

 
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