NexusFi: Find Your Edge


Home Menu

 





Cumulative Index


Discussion in NinjaTrader

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




 
Search this Thread

Cumulative Index

  #1 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7

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 NexusFi?
MC PL editor upgrade
MultiCharts
Better Renko Gaps
The Elite Circle
Cheap historycal L1 data for stocks
Stocks and ETFs
REcommedations for programming help
Sierra Chart
ZombieSqueeze
Platforms and Indicators
 
  #2 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,463 since Jun 2009
Thanks Given: 33,239
Thanks Received: 101,661


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 the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #3 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7


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
  #4 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,463 since Jun 2009
Thanks Given: 33,239
Thanks Received: 101,661


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 the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #5 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7

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
  #6 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,463 since Jun 2009
Thanks Given: 33,239
Thanks Received: 101,661

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 the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #7 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7

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

Reply With Quote
Thanked by:
  #8 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7

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
  #9 (permalink)
Andrew
sea side
 
Posts: 217 since Dec 2009
Thanks Given: 86
Thanks Received: 25

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
  #10 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7


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




Last Updated on January 24, 2010


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts