forextrader2003
New member
Hello All,
Can someone please modify the below, I am trying to see all the following on an OPTIONS PRICE CHART so that I do not have to flip between the ACCOUNT STATEMENT/ACTIVITY and POSITIONS Tabs.
1.) QUANTITY
2.) AVERAGE COST
3.) MARK PRICE
4.) LAST PRICE
5.) TOTAL TRADE COST
6.) PL
7.) PL%
I tried to manipulate the below code but I was unsuccessful, not experienced enough any help would be great appreciated, thank you in advance.
Input ShowPosition = yes;
Input ShowPositionDetails = yes;
def Totqty = GetQuantity();
def openCost = Totqty * GetAveragePrice();
def netLiq = Totqty * close;
def netliqpercent = (NetLiq-NetLiq[1])/NetLiq[1];
Def Display = If (GetAggregationPeriod()==AggregationPeriod.Week or GetAggregationPeriod() ==AggregationPeriod.Month or GetAggregationPeriod() ==AggregationPeriod.OpT_EXP) or !ShowPositionDetails then no else yes;
plot PurchasePrice = if GetAveragePrice() == 0 then Double.NaN else GetAveragePrice();
PurchasePrice.AssignValueColor(If Totqty >0 then Color.DARK_ORANGE else Color.Blue);
PurchasePrice.SetLineWeight(3);
PurchasePrice.SetPaintingStrategy(PaintingStrategy.Line);
#PurchasePrice.SetHiding(!Display);
#plot ManualOpenPL = netLiq – openCost;
def AutoOpenPL = GetOpenPL();
#AddLabel(Totqty and Display, “Qty: ” + Totqty + ” AvgPrice: <b>” + Round(PurchasePrice,2) + “</b> NetLiq: ” + AsDollars(Round(NetLiq,2)) + ” TotCost: “+ Round(openCost,2) +” TodayPL: ” + AsDollars(AutoOpenPL – AutoOpenPL[1])+ ” OpenPL: <b>” + AsDollars(Round(AutoOpenPL,2)) + </b>”,Color.Dark_Gray);
AddLabel(Totqty<0 and ShowPosition, “SHORT QTY: ” + Totqty + ” @” + AsDollars(Round(PurchasePrice, 2))+” NetLiq: ” + AsDollars(Round(NetLiq,2)),Color.Blue);
AddLabel(Totqty>0 and ShowPosition, “LONG QTY: ” + Totqty + ” @” + AsDollars(Round(PurchasePrice, 2))+” NetLiq: ” + AsDollars(Round(NetLiq,2)) ,Color.Dark_Orange);
AddLabel(Totqty and Display, ” AvgPrice: ” + AsDollars(Round(PurchasePrice, 2)) , IF AutoopenPL >=0 then Color.Dark_Green else color.Red);
AddLabel(Totqty and Display, “ThisBarPL: ” + AsDollars(AutoOpenPL – AutoOpenPL[1]) + ” OpenPL: ” + AsDollars(Round(AutoOpenPL, 2)) + ” (” + Round(((NetLiq-OpenCost)/OpenCost)*100,2)+ “%)” , IF AutoopenPL >=0 then Color.Dark_Green else color.Red);
AddLabel(ISNAN(Totqty) and Display, ” No positions currently held.”, Color.Dark_Gray);
Can someone please modify the below, I am trying to see all the following on an OPTIONS PRICE CHART so that I do not have to flip between the ACCOUNT STATEMENT/ACTIVITY and POSITIONS Tabs.
1.) QUANTITY
2.) AVERAGE COST
3.) MARK PRICE
4.) LAST PRICE
5.) TOTAL TRADE COST
6.) PL
7.) PL%
I tried to manipulate the below code but I was unsuccessful, not experienced enough any help would be great appreciated, thank you in advance.
Input ShowPosition = yes;
Input ShowPositionDetails = yes;
def Totqty = GetQuantity();
def openCost = Totqty * GetAveragePrice();
def netLiq = Totqty * close;
def netliqpercent = (NetLiq-NetLiq[1])/NetLiq[1];
Def Display = If (GetAggregationPeriod()==AggregationPeriod.Week or GetAggregationPeriod() ==AggregationPeriod.Month or GetAggregationPeriod() ==AggregationPeriod.OpT_EXP) or !ShowPositionDetails then no else yes;
plot PurchasePrice = if GetAveragePrice() == 0 then Double.NaN else GetAveragePrice();
PurchasePrice.AssignValueColor(If Totqty >0 then Color.DARK_ORANGE else Color.Blue);
PurchasePrice.SetLineWeight(3);
PurchasePrice.SetPaintingStrategy(PaintingStrategy.Line);
#PurchasePrice.SetHiding(!Display);
#plot ManualOpenPL = netLiq – openCost;
def AutoOpenPL = GetOpenPL();
#AddLabel(Totqty and Display, “Qty: ” + Totqty + ” AvgPrice: <b>” + Round(PurchasePrice,2) + “</b> NetLiq: ” + AsDollars(Round(NetLiq,2)) + ” TotCost: “+ Round(openCost,2) +” TodayPL: ” + AsDollars(AutoOpenPL – AutoOpenPL[1])+ ” OpenPL: <b>” + AsDollars(Round(AutoOpenPL,2)) + </b>”,Color.Dark_Gray);
AddLabel(Totqty<0 and ShowPosition, “SHORT QTY: ” + Totqty + ” @” + AsDollars(Round(PurchasePrice, 2))+” NetLiq: ” + AsDollars(Round(NetLiq,2)),Color.Blue);
AddLabel(Totqty>0 and ShowPosition, “LONG QTY: ” + Totqty + ” @” + AsDollars(Round(PurchasePrice, 2))+” NetLiq: ” + AsDollars(Round(NetLiq,2)) ,Color.Dark_Orange);
AddLabel(Totqty and Display, ” AvgPrice: ” + AsDollars(Round(PurchasePrice, 2)) , IF AutoopenPL >=0 then Color.Dark_Green else color.Red);
AddLabel(Totqty and Display, “ThisBarPL: ” + AsDollars(AutoOpenPL – AutoOpenPL[1]) + ” OpenPL: ” + AsDollars(Round(AutoOpenPL, 2)) + ” (” + Round(((NetLiq-OpenCost)/OpenCost)*100,2)+ “%)” , IF AutoopenPL >=0 then Color.Dark_Green else color.Red);
AddLabel(ISNAN(Totqty) and Display, ” No positions currently held.”, Color.Dark_Gray);
Last edited: