NexusFi: Find Your Edge


Home Menu

 





Converting Trading View indicator source code for NT8


Discussion in Traders Hideout

Updated
      Top Posters
    1. looks_one tradecombine with 3 posts (3 thanks)
    2. looks_two SlimSala with 2 posts (1 thanks)
    3. looks_3 kowtko7 with 2 posts (0 thanks)
    4. looks_4 Miesto with 1 posts (0 thanks)
    1. trending_up 8,749 views
    2. thumb_up 4 thanks given
    3. group 8 followers
    1. forum 10 posts
    2. attach_file 1 attachments




 
Search this Thread
  #1 (permalink)
 
SlimSala's Avatar
 SlimSala 
Los Angeles CA/USA
 
Experience: Intermediate
Platform: Ninjatrader
Broker: CQG
Trading: emini ES
Posts: 6 since Jun 2016
Thanks Given: 22
Thanks Received: 11

Would anyone be interested in converting the following indicator code for use in NT8?

Source code (TradingView) starts below this line:



//@version=4

study(title="Beep Boop", shorttitle="Beep Boop", resolution="")

fast_length = input(title="Fast Length", type=input.integer, defval=12)

slow_length = input(title="Slow Length", type=input.integer, defval=26)

EMATrend = input(title="EMA Trend", type=input.integer, defval=50)



src = input(title="Source", type=input.source, defval=close)

signal_length = input(title="Signal Smoothing", type=input.integer, minval = 1, maxval = 50, defval = 9)

sma_source = input(title="Simple MA(Oscillator)", type=input.bool, defval=false)

sma_signal = input(title="Simple MA(Signal Line)", type=input.bool, defval=false)

col_grow_above = #26A69A

col_grow_below = #FF0000

col_fall_above = #FFFFFF

col_fall_below = #FFFFFF

col_macd = #0094ff

col_signal = #ff6a00

fast_ma = sma_source ? sma(src, fast_length) : ema(src, fast_length)

slow_ma = sma_source ? sma(src, slow_length) : ema(src, slow_length)

macd = fast_ma - slow_ma

signal = sma_signal ? sma(macd, signal_length) : ema(macd, signal_length)

hist = macd - signal



if (hist > 0)

hist := 0.1



if (hist < 0)

hist := 0.09



fastMA = ema(close, EMATrend)

//fastMA = 0







plot(hist, title="Histogram", style=plot.style_columns, color=(hist == 0.1 ? ((hist == 0.1) and (close > fastMA) and (open > fastMA) and (low > fastMA) ? col_grow_above : col_fall_above) : ((hist == 0.09) and (close < fastMA) and (open < fastMA) and (high < fastMA)? col_grow_below : col_fall_below) ), transp=0 )

I'd be happy to pay for your service.


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Warsh Opens Today, Hormuz June 19 -- WTI Below $80, Fran …
Prediction Markets & Event Contracts
After $87M Settles NO: Irans Nuclear Redline Sets Up the …
Prediction Markets & Event Contracts
Iran Peace Expired NO: Ceasefire on Life Support, OPEC a …
Prediction Markets & Event Contracts
CME Expands 24/7 Trading to WTI Crude Oil and Gold -- We …
Commodities
CFTC Approves First US Bitcoin Perpetual Futures -- Kals …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
1 thanks
Darmok and Jalad at Tanagra
1 thanks
  #2 (permalink)
tradecombine
SAN ANTONIO
 
Posts: 9 since Feb 2021
Thanks Given: 11
Thanks Received: 6

Yes.

I am currently working to build a NinjaTrader8 (NT8) version of TradingRush's BeepBoop as I get spare time from work.

I don't plan on taking money for it, though, because TradingRush gave away the original TradingView version of BeepBoop.

If you have ThinkOrSwim, you can get a version of BeepBoop at the "usethinkscript" forums.

I'll probably be a few weeks before I'm done, so if you need the NT8 version today, you can get it from a certain website (that I don't want to send any traffic to, so I won't provide the URL), but, if you google "beep boop ninjatrader", it comes up as a top result.

That website is selling it for $150.00 (apparently as a discount.)

Disclaimer: I'm unclear on the reputation of that website or the validity of the tool, so I cannot vouch for it.


Reply With Quote
Thanked by:
  #3 (permalink)
tradecombine
SAN ANTONIO
 
Posts: 9 since Feb 2021
Thanks Given: 11
Thanks Received: 6


Here you go, the indicator is attached here.

Hope it works out for you!


Attached Files
Elite Membership required to download: BeepBoopv2.cs
Reply With Quote
Thanked by:
  #4 (permalink)
 
SlimSala's Avatar
 SlimSala 
Los Angeles CA/USA
 
Experience: Intermediate
Platform: Ninjatrader
Broker: CQG
Trading: emini ES
Posts: 6 since Jun 2016
Thanks Given: 22
Thanks Received: 11

I paid a developer to convert the Code for the Beep Boop indicator from Pine to NT8. It works as designed by Trading Rush.


Started this thread Reply With Quote
Thanked by:
  #5 (permalink)
tradecombine
SAN ANTONIO
 
Posts: 9 since Feb 2021
Thanks Given: 11
Thanks Received: 6

Glad you found a solution that works for you!

Disclaimer: Don't take trading advice from a piece of farming equipment.


Reply With Quote
  #6 (permalink)
 mailonline38 
Sanjose, CA
 
Experience: Beginner
Platform: TradeStation
Trading: TF, YM
Posts: 28 since Dec 2009
Thanks Given: 74
Thanks Received: 15


SlimSala View Post
I paid a developer to convert the Code for the Beep Boop indicator from Pine to NT8. It works as designed by Trading Rush.

Do you have a contact information of that developer and the $? Thanks in advance.


Reply With Quote
  #7 (permalink)
kowtko7
Detroit Michigan
 
Posts: 2 since Jun 2023
Thanks Given: 1
Thanks Received: 0

Hi, would you be kind to convert this code from pine script to NT8 script please.

//@version=5
strategy("Greedy Strategy", pyramiding = 100, calc_on_order_fills=false, overlay=true)
tp = input(10)
sl = input(10)
maxidf = input(title="Max Intraday Filled Orders", defval=5)
strategy.risk.max_intraday_filled_orders(maxidf)
upGap = open > high[1]
dnGap = open < low[1]
dn = strategy.position_size < 0 and open > close
up = strategy.position_size > 0 and open < close
if upGap
strategy.entry("GapUp", strategy.long, stop = high[1])
else
strategy.cancel("GapUp")
if dn
strategy.entry("Dn", strategy.short, stop = close)
else
strategy.cancel("Dn")
if dnGap
strategy.entry("GapDn", strategy.short, stop = low[1])
else
strategy.cancel("GapDn")
if up
strategy.entry("Up", strategy.long, stop = close)
else
strategy.cancel("Up")
XQty = strategy.position_size < 0 ? -strategy.position_size : strategy.position_size
dir = strategy.position_size < 0 ? -1 : 1
lmP = strategy.position_avg_price + dir*tp*syminfo.mintick
slP = strategy.position_avg_price - dir*sl*syminfo.mintick
float nav = na
revCond = strategy.position_size > 0 ? dnGap : (strategy.position_size < 0 ? upGap : false)
if not revCond and XQty > 0
strategy.order("TP", strategy.position_size < 0 ? strategy.long : strategy.short, XQty, lmP, nav, "TPSL", strategy.oca.reduce, "TPSL")
strategy.order("SL", strategy.position_size < 0 ? strategy.long : strategy.short, XQty, nav, slP, "TPSL", strategy.oca.reduce, "TPSL")
if XQty == 0 or revCond
strategy.cancel("TP")
strategy.cancel("SL")
//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)


Reply With Quote
  #8 (permalink)
 MrTrader 
ITAJAI SC/BRAZIL
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Clear Corretora
Trading: DOLFUT, WINFUT
Posts: 341 since Jun 2014
Thanks Given: 1,356
Thanks Received: 229


kowtko7 View Post
Hi, would you be kind to convert this code from pine script to NT8 script please.



//@version=5

strategy("Greedy Strategy", pyramiding = 100, calc_on_order_fills=false, overlay=true)

tp = input(10)

sl = input(10)

maxidf = input(title="Max Intraday Filled Orders", defval=5)

strategy.risk.max_intraday_filled_orders(maxidf)

upGap = open > high[1]

dnGap = open < low[1]

dn = strategy.position_size < 0 and open > close

up = strategy.position_size > 0 and open < close

if upGap

strategy.entry("GapUp", strategy.long, stop = high[1])

else

strategy.cancel("GapUp")

if dn

strategy.entry("Dn", strategy.short, stop = close)

else

strategy.cancel("Dn")

if dnGap

strategy.entry("GapDn", strategy.short, stop = low[1])

else

strategy.cancel("GapDn")

if up

strategy.entry("Up", strategy.long, stop = close)

else

strategy.cancel("Up")

XQty = strategy.position_size < 0 ? -strategy.position_size : strategy.position_size

dir = strategy.position_size < 0 ? -1 : 1

lmP = strategy.position_avg_price + dir*tp*syminfo.mintick

slP = strategy.position_avg_price - dir*sl*syminfo.mintick

float nav = na

revCond = strategy.position_size > 0 ? dnGap : (strategy.position_size < 0 ? upGap : false)

if not revCond and XQty > 0

strategy.order("TP", strategy.position_size < 0 ? strategy.long : strategy.short, XQty, lmP, nav, "TPSL", strategy.oca.reduce, "TPSL")

strategy.order("SL", strategy.position_size < 0 ? strategy.long : strategy.short, XQty, nav, slP, "TPSL", strategy.oca.reduce, "TPSL")

if XQty == 0 or revCond

strategy.cancel("TP")

strategy.cancel("SL")

//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)

What I did was copy your code and ask chatGPT to do the job, so.. maybe this would be a start point to work from.. I am on my cellphone so did not test it..



Certainly! Here's the conversion of the Pine Script code to NinjaTrader 8 (NT8) script:

using System;
using System.Linq;
using System.Text;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Gui.SuperDom;
using NinjaTrader.Gui.Tools;
using NinjaTrader.NinjaScript;
using NinjaTrader.Core.FloatingPoint;
using NinjaTrader.NinjaScript.DrawingTools;
using NinjaTrader.NinjaScript.Indicators;

public class GreedyStrategy : Strategy
{
private double tp = 10;
private double sl = 10;
private int maxidf = 5;
private bool upGap;
private bool dnGap;
private bool dn;
private bool up;
private double lmP;
private double slP;
private double nav;
private bool revCond;
private int XQty;
private int dir;

protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = "Greedy Strategy";
Name = "Greedy Strategy";
Calculate = Calculate.OnBarClose;
EntriesPerDirection = 100;
EntryHandling = EntryHandling.AllEntries;
IsExitOnSessionCloseStrategy = false;
ExitOnSessionCloseSeconds = 30;
IsFillLimitOnTouch = false;
MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
OrderFillResolution = OrderFillResolution.Standard;
Slippage = 0;
StartBehavior = StartBehavior.WaitUntilFlat;
TimeInForce = TimeInForce.Gtc;
TraceOrders = false;
RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
StopTargetHandling = StopTargetHandling.PerEntryExecution;
BarsRequiredToTrade = 20;

AddPlot(Brushes.DarkCyan, "Equity");
}
else if (State == State.Configure)
{
SetStopLoss(CalculationMode.Price, 0);
SetProfitTarget(CalculationMode.Price, 0);
Risk.MaxIntradayFilledOrders = maxidf;
}
}

protected override void OnBarUpdate()
{
upGap = Open[0] > High[1];
dnGap = Open[0] < Low[1];
dn = Position.MarketPosition == MarketPosition.Short && Open[0] > Close[0];
up = Position.MarketPosition == MarketPosition.Long && Open[0] < Close[0];

if (upGap)
{
EnterLongStop(High[1], "GapUp");
}
else
{
CancelOrder("GapUp");
}

if (dn)
{
EnterShortStop(Close[0], "Dn");
}
else
{
CancelOrder("Dn");
}

if (dnGap)
{
EnterShortStop(Low[1], "GapDn");
}
else
{
CancelOrder("GapDn");
}

if (up)
{
EnterLongStop(Close[0], "Up");
}
else
{
CancelOrder("Up");
}

XQty = Position.MarketPosition == MarketPosition.Short ? -Position.Quantity : Position.Quantity;
dir = Position.MarketPosition == MarketPosition.Short ? -1 : 1;
lmP = Position.AveragePrice + dir * tp * TickSize;
slP = Position.AveragePrice - dir * sl * TickSize;

nav = double.NaN;
revCond = Position.MarketPosition == MarketPosition.Long ? dnGap : (Position.MarketPosition == MarketPosition.Short ? upGap : false);

if (!revCond && XQty > 0)
{
SubmitOrderUnmanaged(0, OrderAction.BuyToCover, OrderType.Market, XQty, 0, 0, "TP", "TPSL");
SubmitOrderUnmanaged(0, OrderAction.Sell, OrderType.Stop, XQty, slP, 0, "SL", "TPSL");
}

if (XQty == 0 || revCond)
{
CancelOrder("TP");
CancelOrder("SL");
}
}


Sent using the NexusFi mobile app


Reply With Quote
  #9 (permalink)
kowtko7
Detroit Michigan
 
Posts: 2 since Jun 2023
Thanks Given: 1
Thanks Received: 0

Thank you. I tried using chatgpt but I always get errors when I try to actually run the code in NT8. That's where I get hung up and don't know coding so it's been a dead end for me.


Reply With Quote
  #10 (permalink)
 bash0026 
Minneapolis, Minnesota
 
Experience: Intermediate
Platform: Ninjatrader
Trading: ES
Posts: 2 since Feb 2023
Thanks Given: 0
Thanks Received: 0


I would very much appreciate if someone can please convert this to work on Ninjatrader. I tried to do it myself using ChatGPT but I was getting errors. Thank you


// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org:443/MPL/2.0/
// © ripster47

//@version=4
study("Ripster EMA Clouds","Ripster EMA Clouds", overlay=true)
matype = input(title="MA Type", type=input.string, defval="EMA", options=["EMA", "SMA"])

ma_len1 = input(title="Short EMA1 Length", type=input.integer, defval=8)
ma_len2 = input(title="Long EMA1 Length", type=input.integer, defval=9)
ma_len3 = input(title="Short EMA2 Length", type=input.integer, defval=5)
ma_len4 = input(title="Long EMA2 Length", type=input.integer, defval=12)
ma_len5 = input(title="Short EMA3 Length", type=input.integer, defval=34)
ma_len6 = input(title="Long EMA3 Length", type=input.integer, defval=50)
ma_len7 = input(title="Short EMA4 Length", type=input.integer, defval=72)
ma_len8 = input(title="Long EMA4 Length", type=input.integer, defval=89)
ma_len9 = input(title="Short EMA5 Length", type=input.integer, defval=180)
ma_len10 = input(title="Long EMA5 Length", type=input.integer, defval=200)

src = input(title="Source", type=input.source, defval=hl2)
ma_offset = input(title="Offset", type=input.integer, defval=0)
//res = input(title="Resolution", type=resolution, defval="240")

f_ma(malen) =>
float result = 0
if (matype == "EMA")
result := ema(src, malen)
if (matype == "SMA")
result := sma(src, malen)
result

htf_ma1 = f_ma(ma_len1)
htf_ma2 = f_ma(ma_len2)
htf_ma3 = f_ma(ma_len3)
htf_ma4 = f_ma(ma_len4)
htf_ma5 = f_ma(ma_len5)
htf_ma6 = f_ma(ma_len6)
htf_ma7 = f_ma(ma_len7)
htf_ma8 = f_ma(ma_len8)
htf_ma9 = f_ma(ma_len9)
htf_ma10 = f_ma(ma_len10)

//plot(out1, color=green, offset=ma_offset)
//plot(out2, color=red, offset=ma_offset)

//lengthshort = input(8, minval = 1, title = "Short EMA Length")
//lengthlong = input(200, minval = 2, title = "Long EMA Length")
//emacloudleading = input(50, minval = 0, title = "Leading Period For EMA Cloud")
//src = input(hl2, title = "Source")
showlong = input(false, title="Show Long Alerts")
showshort = input(false, title="Show Short Alerts")
showLine = input(false, title="Display EMA Line")
ema1 = input(true, title="Show EMA Cloud-1")
ema2 = input(true, title="Show EMA Cloud-2")
ema3 = input(true, title="Show EMA Cloud-3")
ema4 = input(false, title="Show EMA Cloud-4")
ema5 = input(false, title="Show EMA Cloud-5")

emacloudleading = input(0, minval=0, title="Leading Period For EMA Cloud")
mashort1 = htf_ma1
malong1 = htf_ma2
mashort2 = htf_ma3
malong2 = htf_ma4
mashort3 = htf_ma5
malong3 = htf_ma6
mashort4 = htf_ma7
malong4 = htf_ma8
mashort5 = htf_ma9
malong5 = htf_ma10

cloudcolour1 = mashort1 >= malong1 ? #036103 : #880e4f
cloudcolour2 = mashort2 >= malong2 ? #4caf50 : #f44336
cloudcolour3 = mashort3 >= malong3 ? #2196f3 : #ffb74d
cloudcolour4 = mashort4 >= malong4 ? #009688 : #f06292
cloudcolour5 = mashort5 >= malong5 ? #05bed5 : #e65100
//03abc1

mashortcolor1 = mashort1 >= mashort1[1] ? color.olive : color.maroon
mashortcolor2 = mashort2 >= mashort2[1] ? color.olive : color.maroon
mashortcolor3 = mashort3 >= mashort3[1] ? color.olive : color.maroon
mashortcolor4 = mashort4 >= mashort4[1] ? color.olive : color.maroon
mashortcolor5 = mashort5 >= mashort5[1] ? color.rgb(179, 179, 43) : color.maroon


mashortline1 = plot(ema1 ? mashort1 : na, color=showLine ? mashortcolor1 : na, linewidth=1, offset=emacloudleading, title="Short Leading EMA1")
mashortline2 = plot(ema2 ? mashort2 : na, color=showLine ? mashortcolor2 : na, linewidth=1, offset=emacloudleading, title="Short Leading EMA2")
mashortline3 = plot(ema3 ?mashort3 : na, color=showLine ? mashortcolor3 : na, linewidth=1, offset=emacloudleading, title="Short Leading EMA3")
mashortline4 = plot(ema4 ? mashort4 :na , color=showLine ? mashortcolor4 : na, linewidth=1, offset=emacloudleading, title="Short Leading EMA4")
mashortline5 = plot(ema5 ? mashort5 : na, color=showLine ? mashortcolor5 : na, linewidth=1, offset=emacloudleading, title="Short Leading EMA5")

malongcolor1 = malong1 >= malong1[1] ? color.green : color.red
malongcolor2 = malong2 >= malong2[1] ? color.green : color.red
malongcolor3 = malong3 >= malong3[1] ? color.green : color.red
malongcolor4 = malong4 >= malong4[1] ? color.green : color.red
malongcolor5 = malong5 >= malong5[1] ? color.green : color.red

malongline1 = plot(ema1 ? malong1 : na, color=showLine ? malongcolor1 : na, linewidth=3, offset=emacloudleading, title="Long Leading EMA1")
malongline2 = plot(ema2 ? malong2 : na, color=showLine ? malongcolor2 : na, linewidth=3, offset=emacloudleading, title="Long Leading EMA2")
malongline3 = plot(ema3 ? malong3 : na, color=showLine ? malongcolor3 : na, linewidth=3, offset=emacloudleading, title="Long Leading EMA3")
malongline4 = plot(ema4 ? malong4 : na, color=showLine ? malongcolor4 : na, linewidth=3, offset=emacloudleading, title="Long Leading EMA4")
malongline5 = plot(ema5 ? malong5 : na, color=showLine ? malongcolor5 : na, linewidth=3, offset=emacloudleading, title="Long Leading EMA5")


// Updated fill function calls using color.new() for transparency
fill(mashortline1, malongline1, color=color.new(cloudcolour1, 45), title="MA Cloud1")
fill(mashortline2, malongline2, color=color.new(cloudcolour2, 65), title="MA Cloud2")
fill(mashortline3, malongline3, color=color.new(cloudcolour3, 70), title="MA Cloud3")
fill(mashortline4, malongline4, color=color.new(cloudcolour4, 65), title="MA Cloud4")
fill(mashortline5, malongline5, color=color.new(cloudcolour5, 65), title="MA Cloud5")


Reply With Quote




Last Updated on July 5, 2024


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts