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 NullPointStrategies, Today, 05:17 AM
    0 responses
    50 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    126 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    69 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X