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 amibroker@yahoogroups.com, "spacebass5000" <spacebass5...@...> 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?
>


Reply via email to