Something like this
//@version=5
VERSION = "V"
SCRIPT_NAME = "Script " + VERSION
// # ========================================================================= #
// # | STRATEGY |
// # ========================================================================= #
// These values are used both in the strategy() header and in the script's relevant inputs as default values so they match.
// Unless these values match in the script's Inputs and the TV backtesting Properties, results between them cannot be compared.
InitCapital = 1000000
InitPosition = 100.0
InitCommission = 0.075
InitPyramidMax = 1
CalcOnorderFills = false
ProcessOrdersOnClose = true
CalcOnEveryTick = false
CloseEntriesRule = "FIFO"
strategy(title=SCRIPT_NAME, shorttitle=SCRIPT_NAME,
overlay=true, pyramiding=InitPyramidMax, initial_capital=InitCapital, default_qty_type=strategy.fixed, process_orders_on_close=ProcessOrdersOnClose,
default_qty_value=InitPosition, commission_type=strategy.commission.percent, commission_value=InitCommission, calc_on_order_fills=CalcOnorderFills,
calc_on_every_tick=CalcOnEveryTick,
precision=9, max_lines_count=500, max_labels_count=500)
buy_condition = close > high[1]
if buy_condition
strategy.entry("Long", strategy.long)
if time == time_close
strategy.close("Long")
For more information on Pine and how to learn Pine: https://www.pinecoders.com/learning_pine_roadmap/