


Sorry gooly I'm a beginner user. 1) I don't mind if I don't get all ticks , I want only open a position when two ticks are processed consecutively by start function. 2) I saved the last tick processed by start with record bid1=Bid as you can see.I also saved the previous tick with record bid0=Bid.Is it incorrect?
int c=0; double bid0=0; double bid1=0; int start() { double stoploss=(Ask+50*Point); double takeprofit=(Ask+500*Point); if (c==0) bid0=Bid; if (c==1) bid1=Bid; if (c==1 && bid1<bid010*Point) OrderSend (Symbol(),OP_SELL,0.01,Bid,3,stoploss,takeprofit); c=c+1; if (bid1>=bid010*Point) c=0; return (0); }

3418 
It is always good practice to give variables recognizable names Why calculate Stoploss and takeprofit every tick? Consider using something like this (just quickly written, not compiled or tested, no error checking) double This_Tick,Last_Tick=0; //++ int start() { This_Tick=Bid; if(Last_TickThis_Tick>10*Point) { double stoploss=(Ask+50*Point); double takeprofit=(Ask500*Point); OrderSend(Symbol(),OP_SELL,0.01,Bid,3,stoploss,takeprofit); } Last_Tick=This_Tick; } Also note that in the tester, ticks are "smoothed out", so jumps that happen in real time will not be apparent in the tester


Thanks GumRai ,you are right, to give variables recognizable name make the EA more understandable. So I rewrote my EA.I hope it is more understandable in this way. int c=0; double FirstTick=0; double SecondTick=0; int stoploss=50; int takeprofit=500; int start() { if (c==0) FirstTick=Bid; //record first tick if (c==1) SecondTick=Bid; //record second tick if (c==1 && SecondTick<FirstTick10*Point) OrderSend (Symbol(),OP_SELL,0.01,Bid,3,Ask+stoploss*Point,Ask+takeprofit*Point); c=c+1; if (SecondTick>=FirstTick10*Point) c=0; //c=0 will give a new FirstTick return (0); } But Why doesn't it open any orders during test? 
3418 


3418 
Anyone can help me?
here is a very simple EA.It should open a sell order when the difference between two consecutive ticks is bigger than 10 point.the second tick must be minor than the first.
the compiler don't give me any errors but when I run it on the tester it doesn't give me any result.the EA during the test doesn't open any orders.what's wrong on the EA?
int c=0;
double bid0=0;
double bid1=0;
int start()
{
double stoploss=(Ask+50*Point);
double takeprofit=(Ask+500*Point);
if (c==0)
bid0=Bid;
if (c==1)
bid1=Bid;
if (c==1 && bid1<bid010*Point)
OrderSend (Symbol(),OP_SELL,0.01,Bid,3,stoploss,takeprofit);
c=c+1;
if (bid1>=bid010*Point)
c=0;
return (0);