ShortPrice slightly off in trade list

The shorting/covering happens in higher timeframe than periodicity in my AFL. At the end i expand the short/shortprice arrays. The shortprice in tradelist is off by 5 cents.

Periodicity is 60 seconds.

timeframeSet(360);
short=<...>;
cover=<...>;
shortPrice=...;
coverPrice=...;
timeframeRestore()
short=timeframeexpand(short, 360);
shortPrice=timeframeexpand(shortprice, 360);
Trace("shortPrice="+shortPrice);// This shows correct value

After backtest the values in trade list and detailed logs has the shortprice off by 5 cents. After timeframeExpand() trace statement shows correct value. But in tradelist and detailed logs the price is off by just 5 cents.

By default prices are subject to checking against bar’s high-low range. You might be passing non tradable price (outside H-L range) and it gets adjusted. Add H and L price to your _Trace

2 Likes

Yes you are absolutely right. thanks.
I use the default expandlast and it marks the signal on the last lower TF bar within the higher TF range. I will now apply some logic to shift the signal to the first bar within the range that falls in the price range. Thanks again tomas.

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