简体   繁体   中英

Change entry/exit text and color in pine script

Is it possible to change the entry and exit text and color in pine script?

Currently they are blue for entry and pink for exit.

Thanks

No but you can add your own labels and hide the built-in labels.

To disable the built-in trade labels on chart, simply go to Settings -> Style and untick the option "Trades on chart".

在此处输入图像描述

See the example below:

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © vitruvius

//@version=5
strategy("My strategy", overlay=true, margin_long=100, margin_short=100)

long_color = input.color(color.green, "Long Color")
short_color = input.color(color.red, "Short Color")
text_color = input.color(color.white, "Text Color")

is_new_long = (strategy.position_size > 0) and (strategy.position_size > strategy.position_size[1])
is_new_short = (strategy.position_size < 0) and (strategy.position_size < strategy.position_size[1])

longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))
if (longCondition)
    strategy.entry("My Long Entry Id", strategy.long)

shortCondition = ta.crossunder(ta.sma(close, 14), ta.sma(close, 28))
if (shortCondition)
    strategy.entry("My Short Entry Id", strategy.short)

plotshape(is_new_long, "Long", shape.labeldown, location.abovebar, long_color, 0, "Long", text_color)
plotshape(is_new_short, "Short", shape.labelup, location.belowbar, short_color, 0, "Short", text_color)

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM