Cumulative Index - futures io
futures io futures trading



Cumulative Index


Discussion in NinjaTrader

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




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
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

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

 
Search this Thread
 

Cumulative Index

(login for full post details)
  #1 (permalink)
singapore
 
 
Posts: 131 since Nov 2009
Thanks: 11 given, 7 received

Hi, I have this ratio ((Close[0]-Open[0])/(High[0]-Low[0])) and would like to create a cumulative index for it. could anyone please help?

Reply With Quote

Can you help answer these questions
from other members on futures io?
Automatic pattern research with NT
Elite Algorithmic NinjaTrader Trading
OFA (Order Flow Analytics) Licence
NinjaTrader
Automating strategies on multiple charts with same symbol
TradeStation
Indicators for pair trading MES and M2K
Platforms and Indicators
MACD line not plotting after change of plot order
NinjaTrader
 
 
(login for full post details)
  #2 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,779 since Jun 2009
Thanks: 32,306 given, 97,566 received


kaywai View Post
Hi, I have this ratio ((Close[0]-Open[0])/(High[0]-Low[0])) and would like to create a cumulative index for it. could anyone please help?

If you mean you want to be able to reference the values in an indexed fashion bar, by bar, then you need a DataSeries.

 
Code
                            
//in #variables
private DataSeries myVal;

//in #init
myVal = new DataSeries(this);

//in #onbarupdate
myVal.Set((Close[0]-Open[0])/(High[0]-Low[0])); 
Then you can reference it, ie:

 
Code
                            
//The EMA 20 of myVal is:
double _ema20 EMA(myVal20)[0]; 
Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to Big Mike for this post:
 
(login for full post details)
  #3 (permalink)
singapore
 
 
Posts: 131 since Nov 2009
Thanks: 11 given, 7 received


BigMike, I'm just trying to create a Line Chart. I plugged your code in and added in the initialize() section:

Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "PCum"));
Plots[
0].Pen.Width = 2;

No chart.

Reply With Quote
 
(login for full post details)
  #4 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,779 since Jun 2009
Thanks: 32,306 given, 97,566 received


kaywai View Post
BigMike, I'm just trying to create a Line Chart. I plugged your code in and added in the initialize() section:

Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "PCum"));
Plots[
0].Pen.Width = 2;

No chart.

It's because you never defined a value for your plot DataSeries (PCum).

PCum.Set(value), same as the above example. Except for Plot's, you don't need to do the #variables and #init stuff, because the DataSeries is handled internally. You just need to .Set it.

If it is still unclear, post the entire indicator.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #5 (permalink)
singapore
 
 
Posts: 131 since Nov 2009
Thanks: 11 given, 7 received

This is what I understood from what you wrote above. Got an error this time. so can't export.
#Variables = Blank
#Init = Added the 2 lines i mentioned above
#onbarupdate
PCum.Set((Close[0]-Open[0])/(High[0]-Low[0]));

Error message: PCum does not exist in the current context. CS0103

Reply With Quote
 
(login for full post details)
  #6 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,779 since Jun 2009
Thanks: 32,306 given, 97,566 received

I'm on my notebook, no NT here or I could just do this for you in 30 seconds and post it . You can still attach the .cs file so I (or others) can look at it, or if still unanswered tomorrow I will try to remember to come back to the thread.

It's really quite simple. You've probably removed something you shouldn't have, have a type-o, or have manually changed the Plot name without updating the public DataSeries in the #params section.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to Big Mike for this post:
 
(login for full post details)
  #7 (permalink)
singapore
 
 
Posts: 131 since Nov 2009
Thanks: 11 given, 7 received

Sorry dude, wasn't aware i could do that. Here it is.

Reply With Quote
The following user says Thank You to kaywai for this post:
 
(login for full post details)
  #8 (permalink)
singapore
 
 
Posts: 131 since Nov 2009
Thanks: 11 given, 7 received

BigMike, I think one of the issues could be when the denominator (i.e High[0]-Low[0] =0). In such a situation, how would I resolve this issue as per your code?

Reply With Quote
 
(login for full post details)
  #9 (permalink)
sea side
 
 
Posts: 217 since Dec 2009
Thanks: 86 given, 25 received

nice idea !
what is more interesting is that
if to plot 1 period MFI (money flow index) and Kaywai index together they looks quite similar.
But if to plot
OBV (on balance volume)
MFI in 3 period
and Kayawai index, "picture" becomes even more interesting

however, "as usual" it's "not working" on treasures

P.s. just don't know if that indicator already "completely created"

Krgds,
Andrew

Reply With Quote
 
(login for full post details)
  #10 (permalink)
singapore
 
 
Posts: 131 since Nov 2009
Thanks: 11 given, 7 received


Andrew,

My chart doesn't plot at the moment. Can I assume you've got a workaround? If you could, could you please assist?

Reply With Quote
 
(login for full post details)
  #11 (permalink)
sea side
 
 
Posts: 217 since Dec 2009
Thanks: 86 given, 25 received

tell what kind of help you need, if I can I will obligatory help

Krgds,
Andrew


kaywai View Post
Andrew,

My chart doesn't plot at the moment. Can I assume you've got a workaround? If you could, could you please assist?


Reply With Quote
 
(login for full post details)
  #12 (permalink)
singapore
 
 
Posts: 131 since Nov 2009
Thanks: 11 given, 7 received

I get an overflow error. I suspect the problem occurs when High[0]-Low[0] = 0. I suppose when High[0]-Low[0]=0, the cumulative index should reflect no change. How do I write that in the NT script?

Reply With Quote
 
(login for full post details)
  #13 (permalink)
sea side
 
 
Posts: 217 since Dec 2009
Thanks: 86 given, 25 received

Kaywai,
Sorry, I'm not "computer man" such questions better to ask Myke.
However, I didn't had any errors, your indicators works on currency futures as on ES, however on treasures and some commodities its not working yet.
Anyway, such questions better to ask Myke and if he will help with that it would be just great.
Good work !

Krgds,
Andrew


kaywai View Post
I get an overflow error. I suspect the problem occurs when High[0]-Low[0] = 0. I suppose when High[0]-Low[0]=0, the cumulative index should reflect no change. How do I write that in the NT script?


Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Cumulative Index


Last Updated on January 24, 2010


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 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