addlabel for entryprice thinkscript code example

Example: addlabel for entryprice thinkscript

plot ThreeBarInsideBar = close > close[1] and
    high[1] < high[2] and
    low[1] > low[2] and
    close[2] > close[3];

def stopPrice = low;
def entryPrice = EntryPrice();
def stopPriceAtEntry = if ThreeBarInsideBar and IsNaN(entryPrice) then stopPrice else stopPriceAtEntry[1];

plot StopLoss = if !IsNaN(entryPrice) then stopPriceAtEntry else Double.NaN;

# LONG
AddOrder(tickcolor = GetColor(9), arrowcolor = GetColor(9), name = "3bp Long", condition = ThreeBarInsideBar, type = OrderType.BUY_TO_OPEN);

#STOP LOSS
AddOrder(OrderType.SELL_TO_CLOSE, low < stopPriceAtEntry, tickcolor = GetColor(5), arrowcolor = GetColor(5), name = "3bp Stop Loss");

# L&F
ThreeBarInsideBar.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
ThreeBarInsideBar.SetLineWeight(3);
StopLoss.SetPaintingStrategy(PaintingStrategy.POINTS);