NexusFi: Find Your Edge


Home Menu

 





Accessing chart region 1 data from chart region 2 study?


Discussion in Sierra Chart

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




 
Search this Thread

Accessing chart region 1 data from chart region 2 study?

  #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?
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
How to apply profiles
Traders Hideout
Better Renko Gaps
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
17 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: 844


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


© 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