NexusFi: Find Your Edge


Home Menu

 





Accessing chart region 1 data from chart region 2 study?


Discussion in Sierra Chart

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




 
Search this Thread
  #1 (permalink)
 funk101 
Margate, Fl.
 
Experience: Advanced
Platform: SierraCharts
Trading: Futures
Posts: 28 since Jun 2009
Thanks Given: 5
Thanks Received: 5

Basically I have a cci study that is in chart region 2, and I would like it to access the EMA data I have in chart region 1 (overlayed on price), how can I access the EMA data from the CCI study?


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Datafeed for Atas
Platforms and Indicators
My Rant with AMP Futures
Trading Reviews and Vendors
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
EA
Platforms and Indicators
Trump Media to sell instant access to market-moving soci …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Mes vs MNQ
6 thanks
NexusFi site changelog and issues/problem reporting
5 thanks
BERN ALGOS algo trading journal
3 thanks
Johnnys Journal
2 thanks
TopStep Trader disappointment
2 thanks
  #3 (permalink)
 vegasfoster 
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 845


This would be an example of a CCI study with another study as the input.

 
Code
#include "sierrachart.h"

SCDLLName("Example") 
/*==========================================================================*/
SCSFExport scsf_Example(SCStudyInterfaceRef sc)
{
	SCSubgraphRef CCI = sc.Subgraph[1];
	
	SCInputRef Study1 = sc.Input[0];
	SCInputRef Study1Subgraph = sc.Input[1];
	
	SCInputRef Period = sc.Input[2];
	
	if (sc.SetDefaults)
	{
		sc.FreeDLL = 0;
		sc.AutoLoop = 1;
					
		CCI.Name="CCI of Another Study";		
		CCI.DrawStyle = DRAWSTYLE_BAR;
		CCI.LineWidth = 3;
		
		Study1.Name = "Input Study #";
		Study1.SetStudyID(1);
		Study1Subgraph.Name = "Input Subgraph #";
		Study1Subgraph.SetSubgraphIndex(0);
		
		Period.Name = "CCI Period";
		Period.SetInt(14);
		
		return;
	}
		
	// Do data processing
	sc.DataStartIndex = Period.GetInt() + 5;

	if(sc.Index >= Period.GetInt() + 5)
	{
		
	SCFloatArray Study1Array;
	sc.GetStudyArrayUsingID(Study1.GetStudyID(),Study1Subgraph.GetSubgraphIndex(),Study1Array);
	
	sc.CCI(Study1Array, sc.Subgraph[0], Period.GetInt(), 0.015);
	CCI[sc.Index] = sc.Subgraph[0][sc.Index];
	
	
	}
}


Attached Files
Elite Membership required to download: Example.cpp
Reply With Quote
Thanked by:
  #4 (permalink)
 funk101 
Margate, Fl.
 
Experience: Advanced
Platform: SierraCharts
Trading: Futures
Posts: 28 since Jun 2009
Thanks Given: 5
Thanks Received: 5

First, thanks for responding, and that did help, however, for some reason I'm running into a snag using multiple studies:
My layout is a ZB daily chart with:
1.EMA 13
2.EMA 34(based on HLC avg)
3.SMA 200

I'm trying to access those three values from my CciSystem.cpp study.
For debugging purposes, I have an sc.AddMessageToLog() spitting out the values. As you can see, the *only* value that is being returned is the emaFast() data. ->(EMA 13);
Last hack, I tried using sc.Subgraph[0].Arrays[x] (Thinking that maybe the values were getting overwritten somehow) and still the same result. What am I missing here?

NOTE: I've been compiling this with VS Studio 2010 so #includes may have to be 'revisited'


Attached Files
Elite Membership required to download: CciSystem.cpp
Started this thread Reply With Quote
  #5 (permalink)
 funk101 
Margate, Fl.
 
Experience: Advanced
Platform: SierraCharts
Trading: Futures
Posts: 28 since Jun 2009
Thanks Given: 5
Thanks Received: 5

I'm reposting my cpp file for anyone to see, but it does work. Basically, the cci study uses the ema data in the main graph to color it's (cci) histogram. This, for me, is still not complete, but is a working version of what I am going for. If anyone knows a more 'elegant' way to do this, beautiful, let me know.


Attached Files
Elite Membership required to download: CciSystem.cpp
Started this thread Reply With Quote
Thanked by:




Last Updated on June 17, 2012


© 2026 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 - Downloads - Top
no new posts