NexusFi: Find Your Edge


Home Menu

 





Indicator Conversion from ThinkScript to NinjaScript


Discussion in Traders Hideout

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




 
Search this Thread

Indicator Conversion from ThinkScript to NinjaScript

(login for full post details)
  #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:	108
Size:	55.6 KB
ID:	331078  
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
convert tradingview pinescript to ninjascript indicator …
The Elite Circle
PowerLanguage/EasyLanguage Trying to use a Function as a …
EasyLanguage Programming
Optimal Futures Trading Workflow
Platforms and Indicators
Your experience with VPS Ninjamobiletrader ?
Trading Reviews and Vendors
Tradestation historical data to be used in NinjaTrader 8
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
GFIs1 1 DAX trade per day journal
32 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
18 thanks
Spoo-nalysis ES e-mini futures S&P 500
16 thanks
backup-borg.sh backup-mysql.sh backup-rsync.sh-notused b …
12 thanks
King Of The Nasdaq
9 thanks

(login for full post details)
  #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

.. 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


© 2023 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