Incorrect code, was: Not one but multiple copies of order

Hi,
I am just beginning with IBC. Tried to set my first order. But code generated instead 1 order multiple copies of it.
Pleas help me and give advise what am I doing wrong.
Thank you. Otmar

IB_Controller_afl

IB_Controller_order

Your code is wrong. Your code calls PlaceOrder each time it is executed. And the formula placed in RT chart is executed with every tick. So you get repetitions.

You code should call PlaceOrder ONCE, store orderID in static variable and don't call PlaceOrder again.
Read this: http://www.amibroker.org/userkb/