Trouble measuring the length of bars in a trade?

Hi guys,

This is the code Im using

TradeLength = BarsSince(Buy); //measures the length of the trade
printf(" \n #bars in trade %g \n",TradeLength);

I've got it listed under the buy = line of code

when I debug the Tradevalue variabel the whole array say 'null'.
When I run the same Tradevalue variable through the printf function above it outputs the values in the interpretation window
When I run the Tradevalue through explore using an addcolumn function, the results come out as zero.

What am I doing wrong?
My objective is to count the number of bars within a trade, how can I do this?

Cheers

It appears your Buy variable is being overridden further down the code?

As per forum rules, post your full code.

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