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 mailonline38 with 1 posts (0 thanks)
    1. trending_up 3,631 views
    2. thumb_up 4 thanks given
    3. group 6 followers
    1. forum 8 posts
    2. attach_file 1 attachments




 
Search this Thread

Converting Trading View indicator source code for NT8

  #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?
Exit Strategy
NinjaTrader
MC PL editor upgrade
MultiCharts
REcommedations for programming help
Sierra Chart
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
31 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
17 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: 73
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: 334 since Jun 2014
Thanks Given: 1,318
Thanks Received: 226


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




Last Updated on June 17, 2023


© 2024 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 - Privacy Policy - Downloads - Top
no new posts