NexusFi: Find Your Edge


Home Menu

 





Cocretum bands convert to NinjaTrader8


Discussion in NinjaTrader

Updated
    1. trending_up 80 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 0 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 Pablherasgarcia 
Madrid
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Ninjatrader
Trading: CL, ES
Posts: 64 since Jan 2015
Thanks Given: 10
Thanks Received: 57

Please could someone convert this TV indicator to NinjaTrader8?


// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org:443/MPL/2.0/
// © foreignHead16013

//@version=5
indicator("Concretum Bands",overlay = true,max_bars_back = 5000,max_lines_count = 500)

k=input.int(10,"Length")
vm=input.float(1,"Volatility Multiplier")
ncol=input.color(color.rgb(255, 235, 59, 70),"NoiseArea color")
ucol=input.color(color.rgb(1, 1, 1, 70),"Upperbound color")
lcol=input.color(color.rgb(1, 1, 1, 70),"Lowerbound color")
extend=input.int(30,"Extend Plotting",maxval=250,inline = "one")
useext=input.bool(true,"",inline="one")
if useext==false
extend:=0
var n=0 // n is number of bars in the current timeframe
var bool first=true


if first
n:=n+1

if session.islastbar and first
first:=false

var bool skipper=true
var skipper_counter=0
if skipper
skipper_counter:=skipper_counter+1

if skipper_counter==k*n+1
skipper:=false
//----------------------------------------------
var candle_counter=0
var float upperbound=0
var float lowerbound=0
var float firstconstant=0
var float secondconstant=0

candle_counter:=candle_counter+1
if session.isfirstbar
candle_counter:=0
firstconstant:=open>close[1]?open:close[1]
secondconstant:=open<close[1]?open:close[1]
upperbound:=open
lowerbound:=open
if skipper==false and candle_counter!=0
// num deno -1
j=1
sigma=0.0
while j<=k
move=math.abs( ( close[n*j]/open[j*n+candle_counter] ) -1 )
sigma:=sigma+move
j:=j+1
sigma:=sigma/k
upperbound:=firstconstant*(1+vm*sigma)
lowerbound:=secondconstant*(1-vm*sigma)

u=plot(upperbound,color=ucol)
l=plot(lowerbound,color =lcol)
fill(u,l,color=ncol)

// plotting forward
prevuy=upperbound
prevlt=lowerbound

if skipper==false and barstate.isrealtime

lm=1
while lm<=(n-candle_counter)
j=1
sigma=0.0
while j<=k
move=math.abs( ( close[(n*j)-lm]/open[j*n+candle_counter] ) -1 )
sigma:=sigma+move
j:=j+1

sigma:=sigma/k
extu=firstconstant*(1+vm*sigma)
extl=secondconstant*(1-vm*sigma)
//log.info(str.tostring(extu)+" ----- "+str.tostring(extl))
line.new(bar_index+lm-1,prevuy,bar_index+lm,extu,color = ucol)
line.new(bar_index+lm-1,prevlt,bar_index+lm,extl,color= lcol)
prevuy:=extu
prevlt:=extl
lm:=lm+1
if lm>extend
break

Here you have the indicator explanation : https://www.tradingview.com/script/CUpWCZhe-Concretum-Bands/


Thak you very much!!

Started this thread Reply With Quote




Last Updated on January 8, 2025


© 2025 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 - Sitemap - Downloads - Top
no new posts