Hi,
can someone help how to code how many bars an order is valid?
For example buy setup:
I get the buy signal on current bar, and I want the signal to be valid 4 following bars, and if the buying condition is not met, delete the order.
Thank you!
George
You can test if your signal was true in the last X bars:
(let’s say your signal condition is a variable named “signal”):
test = summation[4](signal>0)>0
if test then
buy 1 contract at market
endif
If “signal” was true at least 1 time during the last 4 bars, then the condition is still true.
Thank you Nicolas, sorry it is my English. I did not mean that.
Try to clarify:
I get a buy signal on current bar, let’s say the signal is high (0) › high (1)
I do not want to buy at market, but at limit price, lets say “buy 1 contract at low(1) + range(1)• 0,7 stop”.
And I want the order to be valid 4 bars after the entry signal if the price comes lower. If not, after monitoring 4 bars, delete the order.
Thanks again!
LeoParticipant
Veteran
Thanks Leo, I think a understand