Hi,
I don’t know uf the topis is here somewhere already, could not find the answers. I have pine script code for a indicator, which I want to use on Tradovate chart. Can someone please help me, how to easily convert the pine script to Java script.
Thank you very much in advance for your support.
Here is the pine script I need to convert:
//@version=5
strategy(“Nasdaq Futures Day Trading”, overlay=true)
// Define strategy parameters
fastLength = input(10, title=“Fast MA Length”)
slowLength = input(30, title=“Slow MA Length”)
profitTargetPercent = input(1, title=“Profit Target (%)”) / 100
stopLossPercent = input(1, title=“Stop Loss (%)”) / 100
// Calculate moving averages
fastMA = ta.sma(close, fastLength)
slowMA = ta.sma(close, slowLength)
// Strategy logic
enterLong = ta.crossover(fastMA, slowMA)
enterShort = ta.crossunder(fastMA, slowMA)
if (enterLong)
strategy.entry(“Long”, strategy.long)
strategy.exit(“TakeProfit/StopLoss”, from_entry=“Long”, profit=close * profitTargetPercent, loss=close * stopLossPercent)
if (enterShort)
strategy.entry(“Short”, strategy.short)
strategy.exit(“TakeProfit/StopLoss”, from_entry=“Short”, profit=close * profitTargetPercent, loss=close * stopLossPercent)
// Plot moving averages
plot(fastMA, title=“Fast MA”, color=color.blue)
plot(slowMA, title=“Slow MA”, color=color.red)