The below script will not work because I really don't know WTF I'm doing. Thus, I've humbly come here seeking help...
So --- This is a simple script that originated with Mobius in TOS chatroom that places the "AddLabel" items into a box on a chart. I modified the script so now there is a calc that results in also providing the "Cost" of prior for an equity. (For some unfathomable dumb reason TOS doesn't think this value is an important data point so it is missing from the platform. It should be in the Monitor area but its MIA. Go figure.) I'd like to calc the percentage of this "Cost" value v Account Liquidity. In other words, what percentage of total liquidity & Day Trades does an individual holding represent. "Calc" is the current def label used for the calc and that term / lamel or anything else tried crashes the script. In a perfect world I'd also like to have these values available to add as columns to the Monitor area > Account Statement and Activity & Positions. The math is basic; the ability to make this calc behave is a dark mystery to yours truly. ANY and ALL help much appreciated and welcome. Thanks in advance.
PS_If I rem out the "Laid" lines the script runs fine.... but, like the greedy old fool that I am, I want more!
def GetAveragePrice = GetAveragePrice();
def GetOpenPL = GetOpenPL();
def GetQuantity = GetQuantity();
def Liquidity = GetNetLiq ();
def Cost = (GetQuantity * GetAveragePrice);
def Calc = (GetQuantity * PriceType.LAST)/Liquidity;
AddLabel(1, "AvgPrice = " + GetAveragePrice +
" Cost = " + Cost +
" OpenPL = " + GetOpenPL +
" Laid = " + Laid, Color.WHITE);
So --- This is a simple script that originated with Mobius in TOS chatroom that places the "AddLabel" items into a box on a chart. I modified the script so now there is a calc that results in also providing the "Cost" of prior for an equity. (For some unfathomable dumb reason TOS doesn't think this value is an important data point so it is missing from the platform. It should be in the Monitor area but its MIA. Go figure.) I'd like to calc the percentage of this "Cost" value v Account Liquidity. In other words, what percentage of total liquidity & Day Trades does an individual holding represent. "Calc" is the current def label used for the calc and that term / lamel or anything else tried crashes the script. In a perfect world I'd also like to have these values available to add as columns to the Monitor area > Account Statement and Activity & Positions. The math is basic; the ability to make this calc behave is a dark mystery to yours truly. ANY and ALL help much appreciated and welcome. Thanks in advance.
PS_If I rem out the "Laid" lines the script runs fine.... but, like the greedy old fool that I am, I want more!
def GetAveragePrice = GetAveragePrice();
def GetOpenPL = GetOpenPL();
def GetQuantity = GetQuantity();
def Liquidity = GetNetLiq ();
def Cost = (GetQuantity * GetAveragePrice);
def Calc = (GetQuantity * PriceType.LAST)/Liquidity;
AddLabel(1, "AvgPrice = " + GetAveragePrice +
" Cost = " + Cost +
" OpenPL = " + GetOpenPL +
" Laid = " + Laid, Color.WHITE);
Last edited: