NexusFi: Find Your Edge


Home Menu

 





I want to convert this TOS indicator to Ninjatrader


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
Jam29628
Atlanta, Georgia
 
Posts: 1 since Dec 2021
Thanks Given: 0
Thanks Received: 0

Hey. is there anyone who can convert this TOS indicator over to Ninja trader





input KPeriod = 10;
input DPeriod = 10;
input priceH = high;
input priceL = low;
input priceC = close;
input slowing_period = 3;
input averageType = AverageType.SIMPLE;
input showBreakoutSignals = {default "No", "On FullK", "On FullD", "On FullK & FullD"};

def lowest_k = Lowest(priceL, KPeriod);
def c1 = priceC - lowest_k;
def c2 = Highest(priceH, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;


def FullK = MovingAverage(averageType, FastK, slowing_period);
def FullD = MovingAverage(averageType, FullK, DPeriod);


def stochh = (if FullD > 55 then 1 else 0);
def stochl = (if FullD < 45 then 1 else 0);

def datah = (if FullK >= FullK[1] and FullK > FullK[-1] and FullD > 45 then high else Double.NaN);

def dataL = (if FullK <= FullK[1] and FullK < FullK[-1] and FullD < 55 then low else Double.NaN);

plot xdatah = datah ;
plot xdatal = dataL;

def sh = if !IsNaN(xdatah) then high else Double.NaN;
def sl = if !IsNaN(xdatal) then low else Double.NaN;
input showhilowline = yes;
plot stochupcd = if showhilowline == no then Double.NaN else if stochh == 1 then sh + .01 else Double.NEGATIVE_INFINITY;
stochupcd.EnableApproximation();
stochupcd.AssignValueColor(Color.YELLOW);
stochupcd.HideBubble();

plot stochdowncd = if showhilowline == no then Double.NaN else if stochl == 1 then sl - .02 else Double.NEGATIVE_INFINITY;
stochdowncd.EnableApproximation();
stochdowncd.AssignValueColor(Color.YELLOW);
stochdowncd.HideBubble();


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
UMA Votes Tonight: Polymarkets $80M Strategy Bitcoin Bat …
Prediction Markets & Event Contracts
Wood Mackenzie Drops $200 Oil Forecast -- Airspace Expir …
Prediction Markets & Event Contracts
Post-Summit Scorecard: $36M in May 15 Bets Settle Near-Z …
Prediction Markets & Event Contracts
Iran Fired a Missile at Israel Last Night. The $8M June …
Prediction Markets & Event Contracts
Sundays Verdict: Lebanon Locked at 99.85% as Iran June 7 …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
8 thanks
Darmok and Jalad at Tanagra
1 thanks
  #2 (permalink)
 r3torcr0 
Buffalo NY
 
Experience: Beginner
Platform: NinjaTrader
Trading: Forex
Posts: 35 since Sep 2013
Thanks Given: 7
Thanks Received: 28


Jam29628 View Post
Hey. is there anyone who can convert this TOS indicator over to Ninja trader





input KPeriod = 10;
input DPeriod = 10;
input priceH = high;
input priceL = low;
input priceC = close;
input slowing_period = 3;
input averageType = AverageType.SIMPLE;
input showBreakoutSignals = {default "No", "On FullK", "On FullD", "On FullK & FullD"};

def lowest_k = Lowest(priceL, KPeriod);
def c1 = priceC - lowest_k;
def c2 = Highest(priceH, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;


def FullK = MovingAverage(averageType, FastK, slowing_period);
def FullD = MovingAverage(averageType, FullK, DPeriod);


def stochh = (if FullD > 55 then 1 else 0);
def stochl = (if FullD < 45 then 1 else 0);

def datah = (if FullK >= FullK[1] and FullK > FullK[-1] and FullD > 45 then high else Double.NaN);

def dataL = (if FullK <= FullK[1] and FullK < FullK[-1] and FullD < 55 then low else Double.NaN);

plot xdatah = datah ;
plot xdatal = dataL;

def sh = if !IsNaN(xdatah) then high else Double.NaN;
def sl = if !IsNaN(xdatal) then low else Double.NaN;
input showhilowline = yes;
plot stochupcd = if showhilowline == no then Double.NaN else if stochh == 1 then sh + .01 else Double.NEGATIVE_INFINITY;
stochupcd.EnableApproximation();
stochupcd.AssignValueColor(Color.YELLOW);
stochupcd.HideBubble();

plot stochdowncd = if showhilowline == no then Double.NaN else if stochl == 1 then sl - .02 else Double.NEGATIVE_INFINITY;
stochdowncd.EnableApproximation();
stochdowncd.AssignValueColor(Color.YELLOW);
stochdowncd.HideBubble();

Do you have a screen shot of it?


Follow me on X Reply With Quote
  #3 (permalink)
 Apollo11 
KualaLumpur + Malaysia
 
Experience: Intermediate
Platform: TradeStation
Trading: ES, Forex, Futures, Stocks
Posts: 5 since Sep 2015
Thanks Given: 0
Thanks Received: 5


NinjaTrader has stochastic as well. Recommend you have a look there first. Does not make sense to program something in ninja … that ninja already has.


Reply With Quote




Last Updated on March 7, 2022


© 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