NexusFi: Find Your Edge


Home Menu

 





Indicator Conversion from ThinkScript to NinjaScript


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
 powerballretire 
Austin, TX
 
Experience: Intermediate
Platform: NinjaTrader, TOS
Broker: TOS, NinjaTrader, IBKR
Trading: Futures
Posts: 1 since Apr 2011
Thanks Given: 0
Thanks Received: 0

I have a small ThinkScript indicator that I would like to convert to NinjaScript. I got started but I would like some assistance from someone who is better versed in doing such conversions. Thanks in advance.

declare once_per_bar;

def NetChgAvg = MovingAverage(AverageType.WILDERS, close - close[1], 14);

def theta = GetYYYYMMDD();
def LRV = Inertia(close - ((Highest(high, 20) + Lowest(low, 20)) / 2 + ExpAverage(close, 20)) / 2, 20);

def Value = MovingAverage(AverageType.EXPONENTIAL, close, 10) - MovingAverage(AverageType.EXPONENTIAL, close, 50);
def Avg = MovingAverage(AverageType.EXPONENTIAL, Value, 9);

def periodIndx = theta;
def isPeriodRolled = CompoundValue(1, periodIndx != periodIndx[1], yes);
def volumeSum;
def volumeVwapSum;
def volumeVwap2Sum;
if (isPeriodRolled) {
volumeSum = volume;
volumeVwapSum = volume * vwap;
volumeVwap2Sum = volume * Sqr(vwap);
} else {
volumeSum = CompoundValue(1, volumeSum[1] + volume, volume);
volumeVwapSum = CompoundValue(1, volumeVwapSum[1] + volume * vwap, volume * vwap);
volumeVwap2Sum = CompoundValue(1, volumeVwap2Sum[1] + volume * Sqr(vwap), volume * Sqr(vwap));
}
def VWAP = volumeVwapSum / volumeSum;

def RTH = if SecondsTillTime(1600) >= 0 and SecondsFromTime(925) >= 0 then 1 else 0;

def bulltrend = if ((Value > 0 and Avg > 0)) and (LRV > 0 and NetChgAvg > 0) and close[1] > VWAP[1] and close > VWAP then 1 else 0;

def beartrend = if ((Value < 0 and Avg < 0)) and (LRV < 0 and NetChgAvg < 0) and close[1] < VWAP[1] and close < VWAP then 1 else 0;


AssignPriceColor(if bulltrend then Color.GREEN else if beartrend then Color.RED else Color.BLUE);


Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2023-04-18 at 6.04.02 PM.png
Views:	201
Size:	55.6 KB
ID:	331078  
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
SEC Chairman Calls for New Golden Age of SEC-CFTC Regula …
Traders Hideout
More Than Capable: Hegseths War Warning Validates $114M …
Prediction Markets & Event Contracts
Day 96 Missiles Hit Kuwait and Bahrain: June 15 Peace at …
Prediction Markets & Event Contracts
Iran War Prediction Markets: Ceasefire 16%, Ground Invas …
Prediction Markets & Event Contracts
Iran Ceasefire Surges to 19.5% on US 15-Point Plan -- 82 …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
2026 Fire Horse
5 thanks
  #2 (permalink)
 
mewddsltd's Avatar
 mewddsltd 
Anthem, AZ
 
Experience: Intermediate
Platform: NinjaTrader8
Trading: Futures
Posts: 192 since Aug 2020
Thanks Given: 40
Thanks Received: 338

may give it a try but not sure .. this looks beyond my capability

looks like you will need the Welles Wilder Moving Average .. found it here
https://nexusfi.com/local_links.php?linkid=1887


.. you don't have to be the first one at the party .. just be part of the party ..
Reply With Quote




Last Updated on May 31, 2023


© 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