order validity – signal to be valid 4 following bars
- This topic has 4 replies, 3 voices, and was last updated 7 years ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
Forums › ProRealTime English forum › ProOrder support › order validity – signal to be valid 4 following bars
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”):
|
1 2 3 4 5 |
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!
https://www.prorealcode.com/topic/entry-methods-at-market-stop-and-limit/
You can read this information here