I have this working in paper money it shows me the PL live as I am trading. Shows my money up or down in green or red and my buy in amount I am at. Th gray area title on the end.
But now I moved to live trading and it is not working? Even the time in is not working but it all still works in paper trading.
How can I get it working in live trading?
It is this part that is not working it seems - it just stays gray no matter what with no numbers showing and the time in is not changing to the current buy in time as it dose in paper money working right.
_______________
AddLabel(1, "Qty: " + GetQuantity() +
" Avg $" + Entry +
" P/L: " + AsDollars(PL) + " Max L: " + AsDollars(Entry * GetQuantity()),
if PL == 0 then Color.GRAY
else if PL > 0 then Color.GREEN
else Color.RED);
addlabel(1,
" In: " + ( barssince * chartmin) + " minutes",
if GetOpenPL() > 0 then Color.yellow else Color.yellow);
__________________________
Here is the share link
https://tos.mx/!IhORQ6dE
--------------------
#PL_label_days2
#https://usethinkscript.com/threads/changes-days-to-minutes-in-p-l-label.19791/#post-146834
# Average Actual Entry
# Mobius
# 01.01.2018
# Removed portions of Mobius' code, added quantity and replaced Mobius' P/L
# calculation with GetOpenPL().
# Color-coded label, edited study look/colors for personal preference
def na = double.nan;
def bn = barnumber();
# get chart agg time
def chartagg = GetAggregationPeriod();
def chartmin = chartagg / (1000 * 60);
input use_line_limits = yes;#Yes, plots line from/to; No, plot line across entire chart
input linefrom = 100;#Hint linefrom: limits how far line plots in candle area
input lineto = 12;#Hint lineto: limits how far into expansion the line will plot
def PL = GetOpenPL();
def c = if IsNaN(close[-1]) then close else c[1];
def Entry = if IsNaN(GetAveragePrice()) then Entry[1] else GetAveragePrice();
def LastEntryBar = if Entry != Entry[1] then bn else LastEntryBar[1];
def barssince = bn - lastentrybar;
plot Entry_ = if bn >= HighestAll(LastEntryBar) and Entry > 0
then HighestAll(if IsNaN(close[-1]) then Entry else Double.NaN)
else Double.NaN;
Entry_.SetStyle(Curve.SHORT_DASH);
Entry_.SetLineWeight(2);
Entry_.SetDefaultColor(Color.white);
Entry_.HideBubble();
Entry_.HideTitle();
plot "1% Stop" = if Entry_ then Entry_ - .01 * Entry else Double.NaN;
"1% Stop".SetDefaultColor(Color.RED);
plot "1% Target" = if Entry_ then Entry_ + .01 * Entry else Double.NaN;
"1% Target".SetDefaultColor(Color.GREEN);
plot "10% Target" = if Entry_ then Entry_ + .10 * Entry else Double.NaN;
"10% Target".SetDefaultColor(Color.YELLOW);
plot "15% Target" = if Entry_ then Entry_ + .15 * Entry else Double.NaN;
"15% Target".SetDefaultColor(Color.MAGENTA);
plot "20% Target" = if Entry_ then Entry_ + .20 * Entry else Double.NaN;
"20% Target".SetDefaultColor(Color.RED);
input balance = 1000;
def current_price = close;
def limit = balance / current_price;
AddLabel(yes, Concat("Money = ", RoundDown(balance)), Color.MAGENTA);
AddLabel(yes, Concat("Can buy: " , RoundDown(limit)) + " Shares", Color.WHITE);
AddLabel(1, "Qty: " + GetQuantity() +
" Avg $" + Entry +
" P/L: " + AsDollars(PL) + " Max L: " + AsDollars(Entry * GetQuantity()),
if PL == 0 then Color.GRAY
else if PL > 0 then Color.GREEN
else Color.RED);
addlabel(1,
" In: " + ( barssince * chartmin) + " minutes",
if GetOpenPL() > 0 then Color.yellow else Color.yellow);
But now I moved to live trading and it is not working? Even the time in is not working but it all still works in paper trading.
How can I get it working in live trading?
It is this part that is not working it seems - it just stays gray no matter what with no numbers showing and the time in is not changing to the current buy in time as it dose in paper money working right.
_______________
AddLabel(1, "Qty: " + GetQuantity() +
" Avg $" + Entry +
" P/L: " + AsDollars(PL) + " Max L: " + AsDollars(Entry * GetQuantity()),
if PL == 0 then Color.GRAY
else if PL > 0 then Color.GREEN
else Color.RED);
addlabel(1,
" In: " + ( barssince * chartmin) + " minutes",
if GetOpenPL() > 0 then Color.yellow else Color.yellow);
__________________________
Here is the share link
https://tos.mx/!IhORQ6dE
--------------------
#PL_label_days2
#https://usethinkscript.com/threads/changes-days-to-minutes-in-p-l-label.19791/#post-146834
# Average Actual Entry
# Mobius
# 01.01.2018
# Removed portions of Mobius' code, added quantity and replaced Mobius' P/L
# calculation with GetOpenPL().
# Color-coded label, edited study look/colors for personal preference
def na = double.nan;
def bn = barnumber();
# get chart agg time
def chartagg = GetAggregationPeriod();
def chartmin = chartagg / (1000 * 60);
input use_line_limits = yes;#Yes, plots line from/to; No, plot line across entire chart
input linefrom = 100;#Hint linefrom: limits how far line plots in candle area
input lineto = 12;#Hint lineto: limits how far into expansion the line will plot
def PL = GetOpenPL();
def c = if IsNaN(close[-1]) then close else c[1];
def Entry = if IsNaN(GetAveragePrice()) then Entry[1] else GetAveragePrice();
def LastEntryBar = if Entry != Entry[1] then bn else LastEntryBar[1];
def barssince = bn - lastentrybar;
plot Entry_ = if bn >= HighestAll(LastEntryBar) and Entry > 0
then HighestAll(if IsNaN(close[-1]) then Entry else Double.NaN)
else Double.NaN;
Entry_.SetStyle(Curve.SHORT_DASH);
Entry_.SetLineWeight(2);
Entry_.SetDefaultColor(Color.white);
Entry_.HideBubble();
Entry_.HideTitle();
plot "1% Stop" = if Entry_ then Entry_ - .01 * Entry else Double.NaN;
"1% Stop".SetDefaultColor(Color.RED);
plot "1% Target" = if Entry_ then Entry_ + .01 * Entry else Double.NaN;
"1% Target".SetDefaultColor(Color.GREEN);
plot "10% Target" = if Entry_ then Entry_ + .10 * Entry else Double.NaN;
"10% Target".SetDefaultColor(Color.YELLOW);
plot "15% Target" = if Entry_ then Entry_ + .15 * Entry else Double.NaN;
"15% Target".SetDefaultColor(Color.MAGENTA);
plot "20% Target" = if Entry_ then Entry_ + .20 * Entry else Double.NaN;
"20% Target".SetDefaultColor(Color.RED);
input balance = 1000;
def current_price = close;
def limit = balance / current_price;
AddLabel(yes, Concat("Money = ", RoundDown(balance)), Color.MAGENTA);
AddLabel(yes, Concat("Can buy: " , RoundDown(limit)) + " Shares", Color.WHITE);
AddLabel(1, "Qty: " + GetQuantity() +
" Avg $" + Entry +
" P/L: " + AsDollars(PL) + " Max L: " + AsDollars(Entry * GetQuantity()),
if PL == 0 then Color.GRAY
else if PL > 0 then Color.GREEN
else Color.RED);
addlabel(1,
" In: " + ( barssince * chartmin) + " minutes",
if GetOpenPL() > 0 then Color.yellow else Color.yellow);
Attachments
Last edited: