Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Convert from tradingview to ninjatrader

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Convert from tradingview to ninjatrader

    Hello,

    I'm pretty new on the Ninja trader platform. This now two days that I try to convert the strategy "pivot reversal strategy" (wich is free and public on tradingview) to Ninja trader, but I fail every time to have the same result, almost all the commands are different.

    I tried also with ChatGPT for 3 hours but always a lot of error, and when it compiled, not work with the same logic as the one on trading view.

    I really think it's not a task so difficult but I'm just clueless on the Ninjscripte. If someone is ready to help me, I would be very grateful. The strategy is a simple switch from long and short when a pivot is crossed, this is the logic of the pivot from pinescripte that I fail to have the same command in ninjascripte, it work differently every time I tried.

    Sorry for my english it's not my native language. I drop the code below:

    //@version=5
    strategy("Pivot Reversal Strategy", overlay=true)
    leftBars = input(4)
    rightBars = input(2)
    swh = ta.pivothigh(leftBars, rightBars)
    swl = ta.pivotlow(leftBars, rightBars)
    swh_cond = not na(swh)
    hprice = 0.0
    hprice := swh_cond ? swh : hprice[1]
    le = false
    le := swh_cond ? true : (le[1] and high > hprice ? false : le[1])
    if (le)
    strategy.entry("PivRevLE", strategy.long, comment="PivRevLE", stop=hprice + syminfo.mintick)
    swl_cond = not na(swl)
    lprice = 0.0
    lprice := swl_cond ? swl : lprice[1]
    se = false
    se := swl_cond ? true : (se[1] and low < lprice ? false : se[1])
    if (se)
    strategy.entry("PivRevSE", strategy.short, comment="PivRevSE", stop=lprice - syminfo.mintick)


    Thanks in advance!!

    #2
    Hello mate0124,

    Welcome to the NinjaTrader forums!

    Unfortunately, our support team would not be able to assist with translating code from another platform.

    This thread will remain open for any community members that would like to assist.

    You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    51 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X