Newbie AFL question

In the AFL code below at the end where I have the if statement, I am getting an error that I have to use a num or boolean and that I cannot use an array, I don't understand

if (Exit==0 AND High[i] >= (1 + FirstProfitTarget*0.01)*PriceAtBuy)

SetTradeDelays(0,0,0,0); 
BuyPrice = C; 
SellPrice = C;
// Use a moving average crossover to enter long positions 
Buy = Cross(MA(C,5),MA(C,25));
Sell = 0;
// Targets are in percentages. 
FirstProfitTarget = 10;
SecondProfitTarget = 20;
TrailingStop = 10;
// Scalars to keep track of prices while in trade. 
PriceAtBuy = 0;
HighSinceBuy = 0;
Exit = 0;
// Loop through all the bars. 
for( i = 0; i < BarCount; i++ )
{
	if (PriceAtBuy==0 AND Buy[i]==1)
	{
		PriceAtBuy = BuyPrice[i]; 
	}
	else
	if(PriceAtBuy > 0)
	{
			HighSinceBuy = Max(High[i], HighSinceBuy);
			if (Exit==0 AND High[i] >= (1 + FirstProfitTarget*0.01)*PriceAtBuy)

@ativecoloradan, please post the entire code.

I assume that later in the "missing" part of code you are assigning an array to one of the variables used in the condition.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.