Posted By: kerplunk1899
enterLong() behaviour with Entry - 01/08/19 15:52
Hi all,
I am trying to build a simple strategy, but my poor experience with Zorro is getting me stuck with a (I think) simple/stupid issue.
So far in my scripts I have always entered the trades at market.
What I thought I have understood technically is that, in order to get the trade started, the functions enterLong() and enterShort() need to be called only one single time on a single execution of the run()/tick().
And that always worked fine.
What I'm trying to do now, is to enter the trade using Limit orders.
I have tried both Entry and LimitOrders variable, like this:
The CONDITION I'm putting accurately is TRUE only in one single bar and not in the next ones (at least not in the very next ones), as I have always did in my previous strategies based on market enters.
What I would expect is that whenever the price reaches the x price (before the EntryTime), a trade get started.
But this does not happened. The trades are just never opened.
I have tried to place the enterLong() call after and outside the if condition so that it get "always" executed by the script, and the trades actually take place.
This way though, I can hardly control my trades as they get constantly open whenever the price is above x.
This is why I'm pretty sure I haven't quite understood how to use this function properly.
What should I write in order to place a pending order calling a function ONCE? Is it possible or is it just not the way Zorro works?
I really hope anybody can help me!
Thanks so much!
I am trying to build a simple strategy, but my poor experience with Zorro is getting me stuck with a (I think) simple/stupid issue.
So far in my scripts I have always entered the trades at market.
What I thought I have understood technically is that, in order to get the trade started, the functions enterLong() and enterShort() need to be called only one single time on a single execution of the run()/tick().
And that always worked fine.
What I'm trying to do now, is to enter the trade using Limit orders.
I have tried both Entry and LimitOrders variable, like this:
Code:
if( CONDITION ){ Entry=x; enterLong(); }
The CONDITION I'm putting accurately is TRUE only in one single bar and not in the next ones (at least not in the very next ones), as I have always did in my previous strategies based on market enters.
What I would expect is that whenever the price reaches the x price (before the EntryTime), a trade get started.
But this does not happened. The trades are just never opened.
I have tried to place the enterLong() call after and outside the if condition so that it get "always" executed by the script, and the trades actually take place.
Code:
if (NumOpenTotal < 1) enterLong();
This way though, I can hardly control my trades as they get constantly open whenever the price is above x.
This is why I'm pretty sure I haven't quite understood how to use this function properly.
What should I write in order to place a pending order calling a function ONCE? Is it possible or is it just not the way Zorro works?
I really hope anybody can help me!
Thanks so much!