This is in reference to amibroker's AFL scripting language.
I have this in my code:
Buy = Cross(rs,0);
Sell = BarsSince( Buy ) >= 5;
buy = exrem ( buy, sell );
sell = exrem ( sell, buy );
rs is a simple array. The code seems pretty straight forward to me and I have no idea why it's not doing what I want it to do. I want it to sell 5 bars after the actual buy occurs. It does not do this. It sells 5 bars after the buy *signal*, regardless of the fact that the trade is still in play.
I was under the impression that the exrem function solved this issue. But this does not appear to be the case.
How can I rewrite this to have it sell 5 bars after the actual buy occurs? And not 5 bars after a buy signal while the trade is in play?
Thanks.
I have this in my code:
Buy = Cross(rs,0);
Sell = BarsSince( Buy ) >= 5;
buy = exrem ( buy, sell );
sell = exrem ( sell, buy );
rs is a simple array. The code seems pretty straight forward to me and I have no idea why it's not doing what I want it to do. I want it to sell 5 bars after the actual buy occurs. It does not do this. It sells 5 bars after the buy *signal*, regardless of the fact that the trade is still in play.
I was under the impression that the exrem function solved this issue. But this does not appear to be the case.
How can I rewrite this to have it sell 5 bars after the actual buy occurs? And not 5 bars after a buy signal while the trade is in play?
Thanks.