Can someone help me turn this PineScript code into
EasyLanguage to be used on TradeStation?
//@version=5
strategy("Dynamic
Range Deviation Entry", overlay=true)
// Define the lookback period for calculating the range
lookback_period = input.int(20, "Lookback Period")
// Calculate the highest high and lowest low over the lookback period
highest_high = ta.highest(high, lookback_period)
lowest_low = ta.lowest(low, lookback_period)
// Define the range of prices to trade within based on the highest high and lowest low
range_low = lowest_low
range_high = highest_high
// Calculate the range width
range_width = range_high - range_low
// Calculate the entry thresholds based on the deviation from the range
entry_deviation_long = input.float(0.04, "Long Entry Deviation")
entry_deviation_short = input.float(0.033, "Short Entry Deviation")
entry_threshold_long = range_low - (range_width * entry_deviation_long)
entry_threshold_short = range_high + (range_width * entry_deviation_short)
// Place buy and sell orders based on the entry thresholds
strategy.entry("Long", strategy.long, comment="Long Entry", limit=entry_threshold_long)
strategy.entry("Short", strategy.short, comment="Short Entry", limit=entry_threshold_short)
// Close the entire position if it goes against the entry direction
if strategy.position_size != 0 and ((strategy.position_size > 0 and close < range_low) or (strategy.position_size < 0 and close > range_high))
strategy.close("Long", comment="Long Exit")
strategy.close("Short", comment="Short Exit")
// Plot the range and the entry thresholds
plot(range_low, color=color.green, style=plot.style_linebr)
plot(range_high, color=color.red, style=plot.style_linebr)
plot(entry_threshold_long, color=color.green, style=plot.style_circles, linewidth=3)
plot(entry_threshold_short, color=color.red, style=plot.style_circles, linewidth=3)