Welcome to the Traders Laboratory Forums.
Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
Old 01-19-2009, 10:13 PM   #17

Join Date: Feb 2008
Location: zip
Posts: 54
Ignore this user

Thanks: 20
Thanked 11 Times in 8 Posts

Re: TTM Scalp Average for Ninja

maybe someone can chime in and clarify how this statement works in tradestation:

theavg = average((( s_low + s_high) /2 ), len);

I would assume that average requires a series as input. So what happens when s_low + s_high) /2 is inserted instead? Is this truly equivalent to the following ninja statement:

Midpoints.Set((s_low + s_high)/2.0);
theavg = SMA(Midpoints, pLen)[0];
justlurkin is offline  
Reply With Quote
Old 01-19-2009, 11:23 PM   #18

thehaul's Avatar

Join Date: Dec 2008
Location: West Coast, USA
Posts: 35
Ignore this user

Thanks: 10
Thanked 1 Time in 1 Post

Re: TTM Scalp Average for Ninja

If we were averaging the last swing hi/lo I think it would look like this.
Attached Thumbnails
TTM Scalp Average for Ninja-screen-capture-9.png  
thehaul is offline  
Reply With Quote
Old 01-20-2009, 12:24 AM   #19

thehaul's Avatar

Join Date: Dec 2008
Location: West Coast, USA
Posts: 35
Ignore this user

Thanks: 10
Thanked 1 Time in 1 Post

Re: TTM Scalp Average for Ninja

The real question is how you code it so it doesn't smooth with length is added. I will make a video of how the average works within multicharts to see if that sheds some light. We know there's some questionable code in the EL version it just happens to do some good things and some things that can't be answered. This is not a good place for an indicator. Trading should be built around solid mechanics and the user should understand exactly what's going on. I think this is my process now and thankfully Justlurkin is helping me out. There's lots of disciplines in this game. It's all about the one you decide works for you. I've started on this path and want to see it to the end and if the end is a cliff I'm ready to move to the next peak!
thehaul is offline  
Reply With Quote
Old 01-20-2009, 07:11 PM   #20

thehaul's Avatar

Join Date: Dec 2008
Location: West Coast, USA
Posts: 35
Ignore this user

Thanks: 10
Thanked 1 Time in 1 Post

Re: TTM Scalp Average for Ninja

Jan 20, 2009 was a good day even for the Ninja version. It's crazy to me the volume spike didn't happen till the move was over. Maybe it's not crazy? Expected? The cyan arrow is the overnight low, I would think breaking that would of caused more selling volume. I guess everyone believed the Obama rally hype. I know I did when I first turned on the TV.
It obvious there's plenty of trades on this chart. I look at it as the longer average is over the shorter so I just look for shorts. There's a few here. You just have to figure out what plan to follow. I like crosses of the shorter average and not rejections but on the longer I like rejections and not crosses. If that makes any sense.
Attached Thumbnails
TTM Scalp Average for Ninja-screen-capture-10.png  
thehaul is offline  
Reply With Quote
Old 01-20-2009, 07:21 PM   #21

thehaul's Avatar

Join Date: Dec 2008
Location: West Coast, USA
Posts: 35
Ignore this user

Thanks: 10
Thanked 1 Time in 1 Post

Re: TTM Scalp Average for Ninja

Even the NQ had a good setup at the open.
Attached Thumbnails
TTM Scalp Average for Ninja-screen-capture-11.png  
thehaul is offline  
Reply With Quote
Old 01-21-2009, 02:17 PM   #22

Join Date: Feb 2008
Location: zip
Posts: 54
Ignore this user

Thanks: 20
Thanked 11 Times in 8 Posts

Re: TTM Scalp Average for Ninja

I think this makes more sense now. The previous code averaged all points between swing high/lows since it uses a dataseries. This means, that if there are 4 swing points across 100 bars, the midpoint series would be 100 bars wide and an average using, for example, a length of 4 would average the last 4 points and tack it on. However, it seems that you are looking for average of 4 midpoints only, regardless of the number of bars, making the actual dataseries of midpoints much shorter and out of sync with the bars series, an array or list perhaps. This would get you a flat line between swing paints. This probably sounds incoherent but I'll look into it, seems simple enough.

This implies that the following are not equivalent:
tradestation:
theavg = average((( s_low + s_high) /2 ), len);

Ninja:
Midpoints.Set((s_low + s_high)/2.0);
theavg = SMA(Midpoints, pLen)[0];

The tradestation version is adding to "theavg" only when a new swing is detected.
The Ninja version is adding a point on every bar, hence the extreme smoothing.

At least this is my assumption.

Last edited by justlurkin; 01-21-2009 at 02:25 PM.
justlurkin is offline  
Reply With Quote
Old 01-21-2009, 02:27 PM   #23

thehaul's Avatar

Join Date: Dec 2008
Location: West Coast, USA
Posts: 35
Ignore this user

Thanks: 10
Thanked 1 Time in 1 Post

Re: TTM Scalp Average for Ninja

Sounds like you're heading the right direction. I'm not sure how to code it but if the length is set to 4 then the average needs to have 4 points to take the average of the 4 before. So, as price moves on the line is static and plots a flat line based from the last calculation until it has the required 4 to make the next calculation.... i think


thx!
thehaul is offline  
Reply With Quote
Old 01-21-2009, 10:57 PM   #24

Join Date: Feb 2008
Location: zip
Posts: 54
Ignore this user

Thanks: 20
Thanked 11 Times in 8 Posts

Re: TTM Scalp Average for Ninja

This looks more in line with your description, although still buggy ...
Attached Thumbnails
TTM Scalp Average for Ninja-scalpermid.png  
justlurkin is offline  
Reply With Quote

Reply

Tags
average, coding, ninja, ttm

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
Free MP for Ninja darthtrader Market Profile 17 01-19-2009 04:55 PM
? Ninja Trader bobby Introduce Yourself 2 11-22-2008 01:02 PM
Using .eld Indicators in Ninja Trader coldsigh Coding Forum 3 10-09-2008 12:44 AM
Ninja Trader and Interactive Brokers Freddie Brokers and Data Feeds 3 02-21-2007 10:30 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 06:18 AM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.