Exit reason not displayed in the trade list

Hi

As mentioned in this article, I am using custom values for exit signals like 11 to 15 for Sell and 21 to 25 for Cover. But the backtest trade list does not display the exit reason as shown in the refereced article. I am using 5 minute timeframe and backtesting for intraday. Not sure what I am missing

Below is the code snippet:

			if(FixedSLPer > 0 AND High[i] > ShortExitPrice1)
			{
				CoverPriceTemp[i] = Min(CoverPriceTemp[i], ShortExitPrice1);
				if(CoverPriceTemp[i] == ShortExitPrice1)
				{
					Cover[i] = 21;
					PriceAtShort = 0;
					CoverSignal[i] = 1;
				}
			}
			
			if(IntradayExitCond[i] OR NOT DateOK[i] OR NOT FirstDayOk[i])
			{
				CoverPriceTemp[i] = Min(CoverPriceTemp[i], Open[i]);
				if(CoverPriceTemp[i] == Open[i])
				{
					Cover[i] = 22;
					PriceAtShort = 0;
					CoverSignal[i] = 2;
				}
			}
			
			ShortExitPrice2 = (PriceAtShortOriginal * (1 - (ProfitPer/100)));
			if(ProfitPer > 0 AND Low[i] < ShortExitPrice2)
			{
				CoverPriceTemp[i] = Min(CoverPriceTemp[i], ShortExitPrice2);
				if(CoverPriceTemp[i] == ShortExitPrice2)
				{
					Cover[i] = 23;
					PriceAtShort = 0;
					CoverSignal[i] = 3;
				}
			}

Here is the trade list that I get:
Trade%20List

@gandavadi, what are you doing in your formula after the part you posted? By chance are you using ExRem or something else that re-process the signals?
Without seeing the entire code it is difficult to reproduce the issue and provide you some guidance.

1 Like

That is correct, I am using ExRem (check the below) after assigning values to Sell and Cover. Will that be the issue? Any suggestion for the workaround?

	Buy = ExRem(Buy, Sell);
	Sell = ExRem(Sell, Buy);

	Short = ExRem(Short, Cover);
	Cover = ExRem(Cover, Short);

@gandavadi, the easiest solution is to remove the ExRems calls since they are NOT needed by the backtester.

If you still want keep them for charts you could do something similar to the following example (typed directly here so, if needed, please forgive/fix any mistake):

SavedCover = Cover;  // Saves the Cover exit codes to a temporary array
// Remove redundant signals
Short = ExRem( Short, Cover );
Cover = ExRem( Cover, Short );
Cover = IIf( Cover, SavedCover,  0); // Restore the custom exit codes

Apply the same logic to the Sell array.

1 Like

Thank you. Makes sense. I have removed ExRem for Sell and Cover since it is not required as I use the "for" loop to check for redundant signals. But I retained ExRem for Buy and Short as I dont use "for" loops for entry.

Now it works fine...thanks a ton for point out the issue in my code. Below is the screen shot of the trade list.
Trade%20List2

1 Like