Regardless of the number of symbols, availability of funds is only known by the backtester.
Whether a single symbol or a portfolio of symbols, the only 100% reliable way to know is by custom backtesting code that iterates through the open positions list. The list is a collection of Trade objects, each of which has a boolean property named IsLong (true means long, false means short). http://www.amibroker.com/guide/a_custombacktest.html If you want an approximation you can use the Flip function. Buy = ...; Sell = ...; InLongPos = Flip(Buy, Sell); // Will be "1" only for duration of longs. Same principle for shorts. Mike --- In [email protected], "notanaiqgenius" <notanaiqgen...@...> wrote: > > > > > > > Hi Spacebass, > > It depends on whether you are trading multiple symbols. If you are trading > multiple symbols, then you will need to use a custom backtester script to > determine if you are long or short. > > Remember that AFL first ranks signals from multiple markets and then executes > only some of those signals based on certain parameters such as your maximum > positions total and how many existing open positions you currently have. > > If you are only testing on 1 market, then it is much easier to determine if > you are long or short. If you are in Regular Backtest mode (as opposed to > scaling or rotational mode), then you can just check the special Buy and > Short arrays to see if a particular bar is 1 or 0. You can do something like: > > //BEGIN CODE--------------------------------- > > Buy = Close > Ref(Close,-1) and Ref(Close,-1) > Ref(Close,-2); > Short = Close < Ref(Close,-1) and Ref(Close,-1) < Ref(Close,-2); > > SetOption( "InitialEquity", 100000 ); > > Buy = Close > Ref(Close,-1) AND Ref(Close,-1) > Ref(Close,-2); > Sell = 0; > Short = Close < Ref(Close,-1) AND Ref(Close,-1) < Ref(Close,-2); > Cover = 0; > > //remove duplicate Buys after Buy already active or duplicate Shorts after > Short already active > Buy = ExRem(Buy, Short); > Short = ExRem(Short, Buy); > > Var1 = 0; > for(i=0;i<BarCount;i++) > { > if(Buy[i]==1) > //do something > Var1[i] = 0; > if(Short[i]==1) > //do something > Var1[i] = 0; > } > > Plot(Buy,"buy",colorGreen,styleLine); > Plot(Short,"short",colorRed,styleLine); > //END CODE------------------------------------- > > Paul > --- In [email protected], "spacebass5000" <spacebass5000@> wrote: > > > > At any given data-point, is there a way to tell if you are in a trade > > within AFL? If so, is there a way to know if you're long/short? > > >
