Welcome to the Traders Laboratory Forums.
Market Internals Discussion forum on market internals, pit noise/action, and price action to determine the overall strength/weakness of the markets.

Reply
Old 12-22-2008, 10:19 AM   #33

darthtrader3.0beta's Avatar

Join Date: Nov 2008
Posts: 118
Ignore this user

Thanks: 0
Thanked 26 Times in 15 Posts

Re: Ninja Traders...lets Build a Better Mousetrap

Well I should add all this slop I'm posting is namely getting ready for Ninja 7..Maybe someone in the future is learning C#/ninja and can find it usefull..also its incase I lose something in all the junk half finished indicators/strategies on my machine now..
I certainly want to convert this to onmarketdata or however they are going to be handling tick back fills in NT7. The volumeprofile indicator that comes with ninja uses the sorteddictionary and is tick by tick if you want a proper example. With all the graphics override though its hard to understand if you just want to see how sorteddictionary works.
As far as the speed, I guess you could do it faster if you knew alot about hashing. There is no way though I could do it faster though, I'm sure my sorting algorithm would be terribly slow and totally wrong. Having that done behind the scenes is just awesome if your not a real programmer. Especially when you consider adding new elements that need to go between 2 that already exists..you don't have to mess with moving the array all over the place.
Next I'm going to try to make a version of market profile with this and to learn to override plot. One thing I dont get is why they didnt make a big custom function library for plot overrides. Draw lines, draw rectangles, get X Y coordinates, last bar painted, first bar painted...there is only a few things you would want to do but have to dig through all this convoluted code in the indicators right now.
darthtrader3.0beta is offline  
Reply With Quote
Old 12-22-2008, 10:06 PM   #34

darthtrader3.0beta's Avatar

Join Date: Nov 2008
Posts: 118
Ignore this user

Thanks: 0
Thanked 26 Times in 15 Posts

Re: Ninja Traders...lets Build a Better Mousetrap

Well here I proudly present the most useless indicator ever made...load up the chart, load the indicator and it puts a black box over your entire chart...
Really though, I guess Ninja doesn't have documents for the stuff they are doing as far plot overrides?
If you put this in an empty indicator, then put the output window next to the chart and play with it you can get a feel for what these methods are doing.

public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
{


Print("ChartControl.BarSp ace" + " : " + ChartControl.BarSpace);
Print("ChartControl.Canva sRight" + " : " + ChartControl.CanvasRight) ;
Print("ChartControl.Canva sLeft" + " : " + ChartControl.CanvasLeft);
Print("ChartControl.BarMa rginRight" + " : " + ChartControl.BarMarginRig ht);
Print("ChartControl.BarMa rginLeft" + " : " + ChartControl.BarMarginLef t);
Print("ChartControl.BarsP ainted" + " : " + ChartControl.BarsPainted) ;
Print("ChartControl.BarWi dth" + " : " + ChartControl.BarWidth);
Print("bounds.X" + " : " + bounds.X);
Print("bounds.Y" + " : " + bounds.X);
Print("bounds.Height" + " : " + bounds.Height);
Print("bounds.Width" + " : " + bounds.Width);

Print("-----------------");

System.Drawing.SolidBrush myBrush;
myBrush = new System.Drawing.SolidBrush (System.Drawing.Color.Bla ck);
graphics.FillRectangle(my Brush, new Rectangle(ChartControl.Ca nvasLeft,ChartControl.Can vasLeft,ChartControl.Canv asRight,bounds.Height ));

}
Attached Thumbnails
Ninja Traders...lets Build a Better Mousetrap-chartcontrol.jpg  
darthtrader3.0beta is offline  
Reply With Quote
Old 12-22-2008, 10:51 PM   #35

MidKnight's Avatar

Join Date: Oct 2006
Location: Pacman-iverse
Posts: 595
Ignore this user

Thanks: 377
Thanked 326 Times in 186 Posts

Re: Ninja Traders...lets Build a Better Mousetrap

Hi Darth version 3.0b,

Not meaning to detract from the thread intent. But may I ask why all the effort here when something reasonably priced will easily do all this and more? Self-punishment?

All my best,
MK
MidKnight is offline  
Reply With Quote
Old 12-23-2008, 08:56 AM   #36

darthtrader3.0beta's Avatar

Join Date: Nov 2008
Posts: 118
Ignore this user

Thanks: 0
Thanked 26 Times in 15 Posts

Re: Ninja Traders...lets Build a Better Mousetrap

Well I don't see learning new things as self-punishment..I also still will probly want to trade for a few more decades and it seems learning C# to some degree is kind of inevitable. Honestly, figuring this stuff out is quite a bit of fun. I also hope this thread is of use to someone in the future. Ninja's forum is great but they are so quick to respond to issues that when the question is not supported it fragments self learning IMO. Hopefully I will also be able to post complete indicators here at some point, currently though I don't want to mess up someones library incase I do something wrong.
I'm not sure if you mean finalg's market profile? I'm mostly interested in being able to do whatever I want with my charts, not really interested in market profile per se.

Adding on to that last post, once you get a feel for the coordinates of the chart the next logical step would seem to be getting a feel for how things are handled per bar, which seems to be what the getYposition function is for that is added on as an extra function in alot of the indicators that override plot.

private int GetYPos(double price, Rectangle bounds, double min, double max)
{
return (int) ((bounds.Y + bounds.Height) -
((price - min) / ChartControl.MaxMinusMin( max, min)) * bounds.Height);
}

When you pass in the price variable you can get things moving..

int ypos = GetYPos(Close[0], bounds, min, max);
If you then change the above rectange fill by passing in ypos
Rectangle(ChartControl.Ca nvasLeft,ypos,......

You then get a blackbox that shades everything out below the current close of the bar.
This is also a good little reference for how drawing rectangles works
http://www.informit.com/articles/art...25357&seqNum=5

Last edited by darthtrader3.0beta; 12-23-2008 at 09:26 AM.
darthtrader3.0beta is offline  
Reply With Quote
Old 02-28-2009, 10:30 PM   #37

JPx2's Avatar

Join Date: Feb 2009
Location: Columbus
Posts: 39
Ignore this user

Thanks: 3
Thanked 10 Times in 6 Posts

Re: Ninja Traders...lets Build a Better Mousetrap

Did you guys ever get this coded and working?
Thx
JPx2 is offline  
Reply With Quote

Reply

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
Companies That Build Trading Computers? Tasuki Tools of the Trade 68 03-23-2009 03:23 PM
Free MP for Ninja darthtrader Market Profile 17 01-19-2009 04:55 PM
Using .eld Indicators in Ninja Trader coldsigh Coding Forum 3 10-09-2008 12:44 AM
Using Outside Sources to Build Track Record And/or Make Additional Money... brownsfan019 Market Analysis 24 04-30-2008 07:12 PM
Question with Ninja.... Soultrader Brokers and Data Feeds 9 01-25-2007 11:18 AM

All times are GMT -4. The time now is 05:11 PM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.