Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Converting Trading View indicator source code for NT8
Updated June 17, 2023
Converting Trading View indicator source code for NT8
February 3rd, 2021, 08:57 AM
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.
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
February 16th, 2021, 01:45 AM
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.
February 21st, 2021, 06:00 PM
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
March 9th, 2021, 09:05 AM
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.
March 9th, 2021, 03:14 PM
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.
March 9th, 2021, 03:19 PM
Sanjose, CA
Experience: Beginner
Platform: TradeStation
Trading: TF, YM
Posts: 28 since Dec 2009
Thanks Given: 73
Thanks Received: 15
SlimSala
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.
June 16th, 2023, 02:52 PM
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)
June 17th, 2023, 10:09 AM
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
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
June 17th, 2023, 12:57 PM
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.
Last Updated on June 17, 2023