Display Drawdown according to prices used for Entry and Exit

I am using SetOption("PriceBoundChecking",False); to force entry exit prices to Option premiums but my base chart symbol is in range of "30000-40000". Is there a way to get the desired values in drawdown as well according to my option prices and not on base symbol, rest all columns are displaying the values correctly as I need them, if drawdown values can also be modified according to my need it would really help me run my optimizations. Thanks in advance.

Analysis

Explaining it further with a sample code,

I am running backtest and optimize for options data for which the strike price is calculated using the underlying symbol i.e. "BANKNIFTY" in my case. I have been successful in getting correct values in all columns of analysis window except the drawdown and I need drawdown the most to optimize my results. Attaching screenshot of the result, is there a way to attach files? If there is I can attach the sample data to achieve the result in the screenshot.

SetChartOptions(0,chartShowArrows | chartShowDates);

_N( Title = (Name()+" - " +Interval(2)+" "+Date()+"  Open " + open + ", High " + high + ", Low " + low + ", Close " + close ));
_N( Title = (Title + "  {{VALUES}}"));

Plot( C, "Close", IIf( C < Ref( C, -1 ), colorTan, colorSeaGreen ), styleCandle | styleNoTitle );

SetOption("PriceBoundChecking",False);
SetOption("DisableRuinStop", True);

dn = DateNum();
newday = dn != Ref( dn, -1 );

Buy = Sell = Short = Cover = cvr = 0;
BuyPrice = SellPrice = ShortPrice = CoverPrice = 0;
flag=0;

qty=0;
leqt1 = 25*40;

tO = TimeFrameGetPrice("O",inDaily);
	
time = TimeNum()/100==0916;
time1 = TimeNum()/100>=1529;

o1=o2=h1=h2=l1=l2=c1=c2=0;

stk = 0;

optname1="";
optname2="";

_N(optname1 = "");
_N(optname2 = "");

for(i=1;i<BarCount;i++)
{
	if(newday[i])
	{
		optname1 = "";
		optname2 = "";
		
		stk   = (round(to[i]/100)*100);
		optname1 = "BANKNIFTY22901"+NumToStr(stk[i],0.0,False)+"CE";
		optname2 = "BANKNIFTY22901"+NumToStr(stk[i],0.0,False)+"PE";
		
		SetForeign(optname1);
		o1 = O;
		h1 = H;
		l1 = L;
		c1 = C;
		RestorePriceArrays();
		
		SetForeign(optname2);
		o2 = O;
		h2 = H;
		l2 = L;
		c2 = C;
		RestorePriceArrays();
	}
	
	if(time[i] AND !flag)
	{
		ShortPrice[i] = O1[i]+o2[i];
		Short[i] = 1;
		flag = 1;
		qty[i] = leqt1;
	}
	
	if(time1[i] AND flag)
	{
		CoverPrice[i] = o1[i]+o2[i];
		Cover[i] = 1;
		flag = 0;
		qty[i] = 0;
	}
}

SetPositionSize( leqt1, spsShares );

analysis1

@Tomasz any input would be appreciated. TIA

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