Convert NinjaScript to ThinkScript Help - ThinkOrSwim Programming | futures io social day trading
futures io futures trading


Convert NinjaScript to ThinkScript Help
Updated: Views / Replies:719 / 2
Created: by devildriver6 Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Convert NinjaScript to ThinkScript Help

  #1 (permalink)
Trading Apprentice
Dallas, Texas
 
Futures Experience: Intermediate
Platform: TOS and GAIN Capital
Broker/Data: TD Ameritrade and Gain Capital
Favorite Futures: ES and CL
 
Posts: 35 since Jun 2015
Thanks: 2 given, 14 received

Convert NinjaScript to ThinkScript Help

I have this script for a Median Renko bar I'm trying to get into ToS.... Can anyone help?

{
public class MedianRenkoBarsType : BarsType
{
#pragma warning disable 169
// ReSharper disable InconsistentNaming
private static bool registered = Register(new MedianRenkoBarsType());
// ReSharper restore InconsistentNaming
#pragma warning restore 169

public override void Add(Bars bars, double open, double high, double low, double close, DateTime time,int volume, bool isRealtime){ if (bars.Count < 2){
# AddBar(bars, open, high, low, close, time, volume);
return;
}
# Bar bar = (Bar)bars.Get(bars.Count - 1);
# Bar bar1 = (Bar)bars.Get(bars.Count - 2);
# double tickSize = bars.Instrument.MasterInstrument.TickSize;
double rangeValue = Math.Floor(10000000.0 * bars.Period.Value * tickSize) / 10000000.0;
double mymax = bar1.Close >= bar1.Open ? bar1.Close : bar1.Close + rangeValue;
double mymin = bar1.Close <= bar1.Open ? bar1.Close : bar1.Close - rangeValue;
if (bars.Instrument.MasterInstrument.Compare(close, mymax + rangeValue) >= 0)
{
UpdateBar(bars, open, mymax + rangeValue, low, mymax + rangeValue, time, 0);
bool isLastNewBar = close < mymax + 2 * rangeValue;
double newBarOpen = (mymax + bar.Close) * 0.5;
double newClose = Math.Min(bar.Close + rangeValue, close);
double oldClose = bar.Close;
do
{
AddBar(bars, newBarOpen, newClose, newBarOpen, newClose, time, isLastNewBar ? volume : 0);
newBarOpen = (newClose + oldClose) * 0.5;
oldClose = newClose;
newClose = Math.Min(newClose + rangeValue, close);
isLastNewBar = close == newClose;
}
while (bars.Instrument.MasterInstrument.Compare(close, newClose) > 0);
}
else
if (bars.Instrument.MasterInstrument.Compare(mymin - rangeValue, close) >= 0)
{
UpdateBar(bars, open, high, mymin - rangeValue, mymin - rangeValue, time, 0);
double newClose = Math.Max(bar.Close - rangeValue, close);
double newBarOpen = (mymin + bar.Close) * 0.5;
double oldClose = bar.Close;
bool isLastNewBar = close > mymin - 2 * rangeValue;
do
{
AddBar(bars, newBarOpen, newBarOpen, newClose, newClose, time, isLastNewBar ? volume : 0);
newBarOpen = (newClose + oldClose) * 0.5;
oldClose = newClose;
newClose = Math.Max(newClose - rangeValue, close);
isLastNewBar = close == newClose;
}
while (bars.Instrument.MasterInstrument.Compare(newClose, close) > 0);
}
else
UpdateBar(bars, open, high, low, close, time, volume);
}

public override PeriodType BuiltFrom
{
get { return PeriodType.Tick; }
}

public override string ChartDataBoxDate(DateTime time)
{
return time.ToString(Cbi.Globals.CurrentCulture.DateTimeFormat.ShortDatePattern);
}

public override string ChartLabel(Gui.Chart.ChartControl chartControl, DateTime time)
{
return time.ToString(chartControl.LabelFormatTick, Cbi.Globals.CurrentCulture);
}

public override object Clone()
{
return new MedianRenkoBarsType();
}

public override int DaysBack
{
get { return Gui.Chart.ChartData.DaysBackTick; }
}

public override int DefaultValue
{
get { return 4; }
}

public override string DisplayName
{
get { return "MedianRenko"; }
}

public override bool IsIntraday
{
get { return true; }
}

public override bool IsTimeBased
{
get { return false; }
}

public override int MaxLookBackDays
{
get { return 10; }
}

public override int MaxValue
{
get { return -1; }
}

public override double GetPercentComplete(Bars bars, DateTime now)
{
throw new ApplicationException("GetPercentComplete not supported in " + DisplayName);
}

public MedianRenkoBarsType() : base(PeriodType.Custom5) {}

public override int SortOrder
{
get { return 13007; }
}

public override string ToString(Period period)
{
return String.Format("MedianRenko {0} Ticks", period.Value);
}
}
}

Reply With Quote
 
  #2 (permalink)
Trading Apprentice
albuquerque nm/usa
 
Futures Experience: Intermediate
Platform: thinkorswim
Favorite Futures: forex
 
Posts: 29 since Aug 2015
Thanks: 3 given, 8 received


devildriver6 View Post
I have this script for a Median Renko bar I'm trying to get into ToS.... Can anyone help?...

Well, I can't read Ninja but this should help you get started. I became interested in Renko bars awhile back and wrote several TS scripts. BTW, you do know that you can set TOS to display Renko bars? STYLE>>AGGREGATION>>RANGE, then go back and STYLE>>SETTINGS>>TIME_AXIS>>RANGE_TYPE>>RENKO_BARS.
 
Code
#RENKO HILO 1 CANDLE (combo 2 CANDLES h-h and l-l)
declare lower;
input renkosizeup = .0005;
input renkosizedown = .0005;
input renkoHIGHrange = 1;
input renkoLOWrange = 2;
def renko1 = high-low[renkoLOWrange]>=renkosizeup;
def renko1a = high-low[renkoLOWrange]>=renkosizeup AND 
high[renkoHIGHrange]-low[renkoLOWrange]>=renkosizeup;
def renko2 = low[renkoLOWrange]-high>=renkosizedown;
def renko2a = low[renkoLOWrange]-high>=renkosizedown AND
low[renkoLOWrange]-high[renkoHIGHrange]<=renkosizedown;;

plot Above = renko1a;
Above.SetDefaultColor(Color.UPTICK);
Above.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

plot Below = renko2a;
Below.SetDefaultColor(Color.DOWNTICK);
BELOW.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
plot zeroline = 0;
my "renkosizeup" and "renkosizedown" .0005 input settings are for forex. if you trade something else, you might want more convenient default settings. The above code won't display bricks but the advantage is that you'll be able to see price/time on the chart and in the lower study (arrows) detect bricks forming. Best of both worlds, I think.


Last edited by tangerine; August 26th, 2015 at 09:47 AM.
Reply With Quote
 
  #3 (permalink)
Trading Apprentice
ottawa canada
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: es
 
Posts: 19 since Oct 2015
Thanks: 0 given, 1 received


You have to Give it up, TOS doesn't support custom chart type.

Reply With Quote

Reply



futures io > > > > > Convert NinjaScript to ThinkScript Help

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Easy Language code into Thinkscript sboarder13 ThinkOrSwim 20 November 22nd, 2016 01:47 AM
Need a programmer to convert ninjascript into tradestation stefp799 Hire a Consultant or Programmer 0 July 28th, 2015 12:39 PM
Looking for someone who can convert Ninjascript to thinkscript.. Anyone out there? jake0alexander ThinkOrSwim Programming 1 May 22nd, 2015 12:53 PM
[help] Still unable to convert this MQ4 indicator to Thinkscript Ardian1899 ThinkOrSwim Programming 0 July 3rd, 2014 06:10 AM
Convert MQ4 indicator to Ninjascript rookietrader11 NinjaTrader Programming 3 May 3rd, 2013 06:35 PM


All times are GMT -4. The time now is 09:33 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-17 in 0.10 seconds with 19 queries on phoenix via your IP 54.226.34.209