Can we Plot Candle chart using a StaticVar

Hi,

I am writing a staticVar in 1Sec timeframe chart on live markets from 6 diferent charts (Basically Capturing there respective Profit or Loss of the position in realtime). Now i want to plot this staticVar on a 5 min chart in candle stick form... so that i can track the PnL graph in a candle stick visual form (OHLC of 5 mins -- whats the fastes and easiest way?

Thanks in Advance.

//////////////////////////////////////////////////////////////Pnl Calc://////////////////////////////////////////////////////////////////////////////////////
Pnl1=IIf(Start1==1 AND Pos==0,SP1-BP1,IIf(Start1==1 AND Pos==-1,SP1-C1P,0));
Pnl2=IIf(Start1==1 AND Pos==0,SP2-BP2,IIf(Start1==1 AND Pos==-1,SP2-P1P,0));
Pnl3=IIf(Start2==1 AND Pos1==0,SP3-BP3,IIf(Start2==1 AND Pos1==-1,SP3-C2P,0));
Pnl4=IIf(Start2==1 AND Pos1==0,SP4-BP4,IIf(Start2==1 AND Pos1==-1,SP4-P2P,0));
Pnl5=IIf(Start3==1 AND Pos2==0,SP5-BP5,IIf(Start3==1 AND Pos2==-1,SP5-C3P,0));
Pnl6=IIf(Start3==1 AND Pos3==0,SP6-BP6,IIf(Start3==1 AND Pos3==-1,SP6-P3P,0));
Pnl7=IIf(Start4==1 AND Pos4==0,SP7-BP7,IIf(Start4==1 AND Pos4==-1,SP7-C4P,0));
Pnl8=IIf(Start4==1 AND Pos5==0,SP8-BP8,IIf(Start4==1 AND Pos5==-1,SP8-P4P,0));
Pnl9=IIf(Start5==1 AND Pos6==0,SP9-BP9,IIf(Start5==1 AND Pos6==-1,SP9-C5P,0));
Pnl10=IIf(Start5==1 AND Pos7==0,SP10-BP10,IIf(Start5==1 AND Pos7==-1,SP10-P5P,0));
Pnl11=IIf(Start6==1 AND Pos8==0,SP11-BP11,IIf(Start6==1 AND Pos8==-1,SP11-C6P,0));
Pnl12=IIf(Start6==1 AND Pos9==0,SP12-BP12,IIf(Start6==1 AND Pos9==-1,SP12-P6P,0));
Live_Pnl=Pnl1+Pnl2+Pnl3+Pnl4+Pnl5+Pnl6+Pnl7+Pnl8+Pnl9+Pnl10+Pnl11+Pnl12;
StaticVarSet("~~"+Asset_Name+"_"+TSP,Live_Pnl*Lot_Size*8,KeepAll=True,persist=True);

On the PnL Display Graph:::
N75=StaticVarGet("~~NIFTY_TS75");
B75=StaticVarGet("~~BANKNIFTY_TS75");
N100=StaticVarGet("~~NIFTY_TS100");
B100=StaticVarGet("~~BANKNIFTY_TS100");
N125=StaticVarGet("~~NIFTY_TS125");
B125=StaticVarGet("~~BANKNIFTY_TS125");
NVar=StaticVarGet("~~NIFTY_TSVar");
BVar=StaticVarGet("~~BANKNIFTY_TSVar");
NHCE=StaticVarGet("~~NIFTY_HCE");
NHPE=StaticVarGet("~~NIFTY_HPE");
BHCE=StaticVarGet("~~BANKNIFTY_HCE");
BHPE=StaticVarGet("~~BANKNIFTY_HPE");
HBrk=(NHCE+NHPE+BHCE+BHPE);
NBN75=N75+B75+HBrk;
NBN100=N100+B100+HBrk;
NBN125=N125+B125+HBrk;
NBNVar=NVar+BVar+HBrk;

i am able to plot the NBNVar in Line chart format... but can i see the same in candle chart format?

Thanks in Advance

Hi.

I think you posted same question earlier.

So in 1 Sec TF, you will do TIMEFRAMECOMPRESS
3 times For Open,High,Low each with compressOpen, compressHigh, compressLow and
then,
TIMEFRAMEEXPAND
3 times For Open, High, Low each with the non-default mode =expandFirst

After that, store these 3 values in 3 staticVar.

For 4th variable, Close, you can just save directly to staticVar. AB should be able to compressLast due to its default nature.

Then, in 5-min TF,
call the PLOTOHLC
use the 4 staticVar created in 1 sec TF for each O,H,L,C argument.

I didnt write any code but it should work after reading the thread below.

Refer to thread below and this post from Matt.

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