# Using AddtoComposite to create composite OHLC Chart

Hi Team i was trying to find the ATM Options Straddle pair for a given index at any bar by using the underlying close and rounding it and matching it with the same strike price.

For eg if a given underlying is at 25629 then it rounds to 25600 and both CE and PE of 25600 would be my straddle pair which are added via addtocomposite and plotted.

Everything works fine and easily but then i wanted to go a step further and plot OHLC of this newly created composite( straddle pair) and was able to do that easily too.

However in backtest the high of this straddle for any given bar is the highest of the call option(CE) + highest of PE option for that bar.
However we know that when the CE is at the highest point the PE would not be at the highest so the OHLC shown is not true.

Hence the high of the Straddle as shown by composite is the never the true high for that timeframe as CE and PE can never be at highs of the bar at the same time.

Any Suggestions how to plot true high/low of a straddle pair in realtime and historical recreation.
Following is the code snippet used to plotOHLC of the composite and display it.

``````//************* Rounded close of index to find ATM call/put strike***************************************************************************************//

roundedclose = niftyclose/100 ;
roundedclose1 = round(roundedclose)*100 ; // get nearest rounded reference point.. eg if price = 9588 gives you 9500 if 9525 still gives 9500

//**********************************************************************************************************************************************************/

values = strikeprice==roundedclose1;

AddToComposite( IIf(values , Close , 0), "~Totalstraddlesymbols", "C" ,  1+2+4+8+16);
AddToComposite( IIf(values , Open , 0), "~Totalstraddlesymbols", "O" ,  1+2+4+8+16);
AddToComposite( IIf(values , High , 0), "~Totalstraddlesymbols", "H" ,  1+2+4+8+16);
AddToComposite( IIf(values , Low , 0), "~Totalstraddlesymbols", "L" ,  1+2+4+8+16);

graph0 = foreign( "~Totalstraddlesymbols", "V");

PlotOHLC(Foreign("~Totalstraddlesymbols" , "O") ,Foreign("~Totalstraddlesymbols" , "H") , Foreign("~Totalstraddlesymbols" , "L") , Foreign("~Totalstraddlesymbols" , "C") ,"Straddle_value"  ,ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle())  ;

//****************************************ENd of code*********************//
``````