we are working on an automated trading system like the most in here i would say ;)
The following is crazy..
We have a code structure, which should order a "buy", then do some things, an if some events are happening, it should execute a function which include the ordersend function.
e.g. : Buy... events .. buy <--- this buy, we cant get executed. It is impossible and we don't know why. We've tried to shoot some troubles by printing infos about the position, in which the code is doing wrong.
We've done the following:
Print("The Order XY at the codeposition ABC was sent");
The mystic is, we are getting the "Print", but there are no orders. We cant understand why this is happening. :(
Anybody who is able to unterstand what i'm tryin to explain? Sry, I am from Germany and my english is just school-based. I hope it is enough.
If anybody know this problem, even a solution, you would make us very very happy. And thank you all so much, who will try to help us. :)
greetz from germany :)
did you get a ticket number returned by OrderSend() ?
to test your code you should do something like this:
int ticket = OrderSend(Symbol(),OP_BUY ....etc) ;
if(ticket < 0) //means a valid ticket was not returned
Alert("OrderSend Error = ", err);
thank you for responding. We had not tried yet.
When the strategy-function calls our own OrderSend-function, then nothing happened. But if we call this own OrderSend-function on start() or init(), everything is ok.
But, we tested, if the function would be called, by set the Print Function under the own ordersend function, the print function was executed. But not the ordersend, that strange, because the ordersend should be called before the print function is called.
We don't get a ticket number, because we haven't set the function to an int var. Shell we do this?
We cant unterstand, why the ordersend doesn't work in the stategyfunc.
OrderSend() returns a value . . .
if (OrderSend(Symbol(),OP_BUY ....etc) < 0)
Alert("OrderSend Error = ", GetLastError());
thank you so much for trying to help us!
ok, we are using the return value now. and we get a "-1". Has anyone an idea why? I mean, what are reasons for getting "-1"?
NewLong() // longs over and over will be opened.
NewLong(); // this long will be opened
Print("StartLong"); / this is printed in experts
NewLong(); // nothing happend :?
Print("This Long was send because of event x"); // this is printed in experts
thank you :)
Please enable the necessary setting in your browser, otherwise you will not be able to log in.