Function start() won't work... Need a hint

 

Hi!


I'm new here. I'm a master in computer science but I'm new to MQL4 language.

Wherever I have read about Expert Advisers, manuals say that function start() is called whenever a new tick is received.

I wanted to write something simple and stupid, but working for the start, so I wrote this:


int start()
{

int total=OrdersTotal();
int ticket;
if (total==0) ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-35*Point,Ask+15*Point,NULL,0,0,Green);


return(0);

}


By this I wanted to make EA to open a new buy order whenever there is no orders in the market already. Id start() is really executed every time a new price is received, EA should open one order after another as soon as the previous one is closed. I left the functiona init() and deinit() empty.


When I loaded my EA into trader nothing happened. If I put the same code into init() function, it executes (places an order), but only once.

The checkbox "Allow live trading" in EA's properties is checked.


What am I doing wrong/not doing/missunderstanding??? can anyone HELP me get started??



 
what about "Enable/disable expert advisers" button?
 

have u read the MQL4 Book ?

is good place to get 'handle' on this system.

if compSci then u know all bout threads...

think single threading in ClientTerminal.

cannot just blast out TradeOps whenever want to.

there are builtins that allow code test when environment 'good to go' rea: TradeOps. u read MetaEditor help - is VIP, or course go online and surf here ;)

also please consider using error checking in any code experiment with.

save many headaches on learn path.

Print() is ideal for shoving out stuff to see wat code really doing.

Best 2 U

btw,

your OrderSend(...) actuals may like to be massaged by NormalizeDouble()

"The calculated StopLoss and TakeProfit values, as well as open price of pending orders must be normalized with a precision the value of which is stored in the pre-defined variable of Digits."

 
stringo:
what about "Enable/disable expert advisers" button?

It works!!! I got it!!!! :)) THANK YOU, stringo!!!! ;)