NT7 indicator "LogReturns" - NinjaTrader Programming | futures io social day trading
futures io futures trading


NT7 indicator "LogReturns"
Updated: Views / Replies:3,823 / 10
Created: by MXASJ Attachments:8

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
 8  
 
Thread Tools Search this Thread
 

NT7 indicator "LogReturns"

  #1 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received

NT7 indicator "LogReturns"

I'm slowly putting together some tools to help me with volatility analysis in NT7. The attached indicator looks at the period log of returns. The attached chart gives you an idea of what people mean by Volatility Clustering .

The guts of the code is:

 
Code
                            
if(CurrentBar || Close[1] <= 0)
{
Value.Set(0);
return;
}
 
plotLog = (Math.Log(Close[0]/Close[1])); 
Value.Set(plotLog); 
That snippet is part of the HistoricalVolatility indicator I've been developing in the Elite section.

I'm posting this here for any suggestions/corrections belore posting it in downloads. On its own it is not that exciting but may be useful as a part of something bigger.

Attached Thumbnails
NT7 indicator &quot;LogReturns&quot;-logreturns.jpg   NT7 indicator &quot;LogReturns&quot;-withatrandhistvolrainbow.jpg   NT7 indicator &quot;LogReturns&quot;-withzscoreoflogreturns.jpg  
Attached Files
Register to download File Type: zip LogReturns.zip (1.9 KB, 34 views)

Last edited by MXASJ; June 19th, 2010 at 12:10 AM. Reason: Adds second chart that includes ATR and HistoricalVolatilityRainbow indicators
Reply With Quote
The following 4 users say Thank You to MXASJ for this post:
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received


Upload test to the new server. And a cool chart...

Attached Thumbnails
NT7 indicator &quot;LogReturns&quot;-vol.jpg  
Reply With Quote
 
  #4 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary

A volatility cluster is related to a fat tail, so I am listening attentively, LOL.

If you print volatility and/or logarithmic returns, this is nice, but what is your intention? I agree that voaltility is important, even if you do not want to calculate option prices. I use volatility for my trading approach in the following ways

1) Keltner Channels, they use the average true range, which is a measure of volatility. I prefer Keltner Channels to Bollinger Bands, as Bollinger Bands are sensitive to both directional bias and volatility (it is a two-in-one indicator).

2) The classic floor pivots use yesterday's range to establish targets, so they use 1-day-volatility.

3) I also use a multiple of ATR as a trailing stop, or to enter pullback trades.

Now thinking about, how to use those log returns. Volatility clustering suggests that you get a better prediction for future volatility if you give more weight to recent volatility, when calculating an average. This could be achieved by replacing the ATR with an EMA of the last true ranges. But can't see how to use log returns for this.

The main application that I would have for log returns is to calculate correlation coefficients for pairs of instruments. You could code an indicator that monitors the log return of two instruments and then plots the correlation between the returns. You could then displace one of the series by one or more periods to find out, whether returns of the first instrument could "predict" returns of the other one, prerequisite to intermarket analysis.

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #5 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received


Fat Tails View Post
...The main application that I would have for log returns is to calculate correlation coefficients for pairs of instruments. You could code an indicator that monitors the log return of two instruments and then plots the correlation between the returns. You could then displace one of the series by one or more periods to find out, whether returns of the first instrument could "predict" returns of the other one, prerequisite to intermarket analysis.

It would be a different formula than what I have been playing with for basic pairs trading, but definately worth looking at. Thank you for that comment.

I started looking at the vol thing because one thing that has worked for me recently is some options swing trading... buying vol when vega drops on an "inside" day during high vol periods, and selling it when vega picks up again a day or five later. Its an opportunistic trade that by definition only presents itself <5% of the time. That would be 12 times per year using daily charts.

Like I said LogReturns might work well as part of something else. In the last chart I posted, I plot the ZScore of the LogReturns and found it interesting. I'll be updating the ZScore code I have in the Elite downloads section with the code I used for the indi above this weekend.

Reply With Quote
 
  #6 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received

The code for the ATRRainbow indicator is attached. Its one I threw together to compare with other things (like LogReturns) so it could probably be better. I'll post it in the downloads section after my usual comment/rethink period.

Attached Thumbnails
NT7 indicator &quot;LogReturns&quot;-atrrainbow.jpg  
Attached Files
Register to download File Type: zip ATRRainbow.zip (2.1 KB, 34 views)
Reply With Quote
The following user says Thank You to MXASJ for this post:
 
  #7 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received

I'm just screwing around here but here is a Weekly. Fat Tails() worth looking at.

Attached Thumbnails
NT7 indicator &quot;LogReturns&quot;-weekly.jpg  
Reply With Quote
 
  #8 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary

It is known that stock markets are asymmetrical (flat peaks and sharp troughs), it follows that (a moving average of) volatility declines in a rising market and increases during declines. The question is, whether volatility produces leading or conincident signals.

For the topping process I could not see any divergences, but for the bottoming process there is a clear divergence that can be seen on the weekly chart. The stock market makes a new low, but volatility (fear) does not reach new highs.

An alternative to historical voloatility would be implied volatility (VIX) or very basic, volume. The force index of Alexander Elder is one of the various indicators that would produce a divergence allowing to identify a low as well.

Comparing ATR (Rainbow) with VIX and force index may show similar results. They can identify climax type situations and produce divergences. So you can use them to identify stock market bottoms or commodity tops, as stock markets from sharp troughs and commodities sharp tops. But they would be unusable to detect stock market tops and commodity bottoms.

Would need to do some backtesting to check whether the divergences give us an edge, and whether ATR can beat VIX and/or volume.


MXASJ View Post
I'm just screwing around here but here is a Weekly. Fat Tails() worth looking at.


Reply With Quote
 
  #9 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received

Elders Force Index is a Price+Volume thing I believe. Here is how TOS does it:

 
Code
                            
#
# thinkorswim, inc. (c) 2007
#
declare lower;
input length 13;
plot FI ExpAverage(data = (close close[1]) * volumelength);
FI.SetDefaultColor(GetColor(8));
plot ZeroLine 0;
ZeroLine.SetDefaultColor(GetColor(5)); 
Proper IV figures require an option price to calculate I believe, and that is dificult to code (for me) in NT. I can get NT to give me specific options prices if I set them up in Instrument Manager (I do that now with IQFeed), but there are better tools for that. So your reference to the VIX is interesting. If the VIX (and other index IV indexes) is our only source of IV data in NT, that is something to keep in mind.

Reply With Quote
 
  #10 (permalink)
Trading Apprentice
London
 
Futures Experience: None
Platform: NinjaTrader
Favorite Futures: Currencies
 
Posts: 27 since Jun 2011
Thanks: 4 given, 2 received


Hi,

Your work looks interested. Could you share the code of Z-Score(LogReturns) indicator?

Thanks

Reply With Quote

Reply



futures io > > > > > NT7 indicator "LogReturns"

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Better Momentum Indicator" for NT7 crimmins NinjaTrader 20 January 28th, 2015 09:12 PM
dealing with GetCurrentBidVolume and GetCurrentAskVolume , "long" casting into "int" jmejedi NinjaTrader Programming 4 May 23rd, 2011 10:33 AM
jtRangeMakrker7 - Printing in "Output" window on NT7....4 Affliction NinjaTrader 5 April 29th, 2011 10:22 AM
RJay's "Trader Volume" and "Trader Tick" Indicator Suites RJay The Elite Circle 20 December 20th, 2010 06:01 PM
"Wicked Renko" indicator for NT7 tr8ermom NinjaTrader 2 November 9th, 2010 11:20 AM


All times are GMT -4. The time now is 09:30 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-12 in 0.17 seconds with 20 queries on phoenix via your IP 54.221.93.187