To count and limit number of open positions
Maximum Open Positions
No. of Orders - Set this maximum no. of orders to be placed. In AFL it is used as OPC < ORD, But it work as OPC <= ORD.
Square OFF - Set this time to reset order count.
Reset Time - It have 3 options , New Day, End of Day and Square off time, As per this option count will reset at that time.
This AFL is sponsored by Balakrishnan,Tamilnadu
Freelance for Setup, Suggestions and Modifications
Button AFL
Max Positions - Enter here Maximum no of position.
Reset - Reset Positions Count.
Click Buy / Short increase the count. Sell / Cover decrease the count.
Once Per Bar Order AFL
Auto repeat of Scan / Explore and Refresh of Chart create continuous signals. To avoid repeating orders and one per bar use this afl along with max open positions count.
Static Variables
In this AFL and many afl use Static variables which increase memory. you can check and remove static variable.
To Know number of Static Variables saved in your Amibroker, use the following code
Filter = 1;
AddColumn(StaticVarCount(),"");
To remove all saved Static Variables, use the following code
StaticVarRemove("*");