I have a Amibroker strategy with buy/sell and short/cover conditions.
(I have only very basic idea about afl )
I plan to use it with algo system to place order in terminal.
Some times it is repainting. To avoid it I can use some thing like Buy=ref(buy,-1);
On referring previous candle to place order, slippage of price is more.
So I want to use buy or short condition in current bar only with taking some risk.
Is it possible to use static variable in these conditions?
My requirement is as follows.
[login to view URL] buy/short signal comes in AMI , Buy/short order is placed.
[login to view URL] open of the next candle, AFL has to check the previous bar has the signal or not.
[login to view URL] signal present, nothing to be done.
[login to view URL] no signal (repainting signal) in previous candle, exit the position immediately with sell/cover order.
I think this order details will not be shown in backtesting. But that is not a [login to view URL] I want to place order on a signal and want to exit on next bar , if it is a false signal.
I need afl code for this particular function, that can be added with any of my afl with buy sell conditions.