Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
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 for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
What is wrong with that ? Arraly pole1 and pole2 empty ?!?!
Updated March 17, 2017
Top Posters
looks_one
bluewave65
with 3 posts (0 thanks)
looks_two
yonatan
with 2 posts (1 thanks)
looks_3
Quick Summary
with 1 posts (0 thanks)
looks_4
mkata
with 1 posts (0 thanks)
trending_up
1,202 views
thumb_up
1 thanks given
group
3 followers
forum
6 posts
attach_file
1 attachments
What is wrong with that ? Arraly pole1 and pole2 empty ?!?!
February 26th, 2017, 04:54 AM
CZECH REPUBLIC
Posts: 24 since Nov 2015
Thanks Given: 1
Thanks Received: 0
Hi, i got a simple code , but arrays pole1 and pole2 remain empty ? Why ?
Pls HELP ....
dave
p.s.: Original sierra code with
InputArray1.SetStudySubgraphValues(0,0);
sc.GetStudyArrayUsingID(
works just fine ...... i don`t get it
I just need get arrays from another chart ....
Code
#include "c:\uziv\trade\1510\ACS_Source\sierrachart.h"
SCDLLName("KORELACE")
/*==========================================================================*/
SCSFExport scsf_korelace(SCStudyInterfaceRef sc)
{
SCSubgraphRef CC1 = sc.Subgraph[0];
SCInputRef InputArray1 = sc.Input[0];
SCInputRef InputArray2 = sc.Input[1];
SCInputRef Length = sc.Input[6];
if(sc.SetDefaults)
{
sc.GraphName = "KORELACE";
sc.GraphRegion = 1;
CC1.Name = "CC1";
CC1.DrawStyle = DRAWSTYLE_LINE;
CC1.PrimaryColor = RGB(255,0,0);
CC1.DrawZeros = true;
InputArray1.Name = "CC1 - Instrument 1";
InputArray1.SetChartStudySubgraphValues(1, 0, 0);
InputArray2.Name = "CC1 - Instrument 2";
InputArray2.SetChartStudySubgraphValues(1, 0, 0);
Length.Name = "Interval";
Length.SetInt(200);
sc.AutoLoop = 1;
sc.FreeDLL = 1;
sc.CalculationPrecedence = LOW_PREC_LEVEL;
return;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Definovani Poli Pro Prevzeti Dat z Externich Grafu
sc.DataStartIndex = Length.GetInt();
SCFloatArray pole1;
sc.GetStudyArrayFromChartUsingID(InputArray1.GetChartStudySubgraphValues(), pole1);
if(pole1.GetArraySize() < sc.ArraySize)
return;
SCFloatArray pole2;
sc.GetStudyArrayFromChartUsingID(InputArray2.GetChartStudySubgraphValues(), pole2);
if(pole2.GetArraySize() < sc.ArraySize)
return;
CC1[sc.Index] = sc.GetCorrelationCoefficient(pole1, pole2, Length.GetInt());
}
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
February 26th, 2017, 11:37 AM
Haifa Israel
Experience: Beginner
Platform: sierra chart
Broker: Optimus Trading Group/Rithmic
Trading: es
Posts: 91 since Apr 2012
Thanks Given: 50
Thanks Received: 71
As you ca see here:
InputArray1.Name = "CC1 - Instrument 1";
InputArray1.SetChartStudySubgraphValues(1, 0, 0);
InputArray2.Name = "CC1 - Instrument 2";
InputArray2.SetChartStudySubgraphValues(1, 0, 0);
Both InputArray1 and InputArray2 point to Subgraph 0 of Study 0 on Chart 1.
Is this want you want? Are you using the default settings ?
February 26th, 2017, 12:11 PM
CZECH REPUBLIC
Posts: 24 since Nov 2015
Thanks Given: 1
Thanks Received: 0
I know ... but it isn`t a problem ....
If i change it ........ no solution ........ same problem .......
February 26th, 2017, 01:43 PM
Haifa Israel
Experience: Beginner
Platform: sierra chart
Broker: Optimus Trading Group/Rithmic
Trading: es
Posts: 91 since Apr 2012
Thanks Given: 50
Thanks Received: 71
I added to the code a few lines that send the values of the compared 2 arrays to the message log. As you can see in the attached txt file the arrays are definitely not empty. I compared the Sp-TICK and NYSE -Tick, not CCIs.
One reason for getting zeros in the arrays is if the chart on which you apply the study has a larger sc.ArraySize (More bars) than the charts that you reference. In this case pole1[sc.Index] and pole2[sc.Index] will have zeros for sc.Index values that are larger than the last sc.Index on those charts.
p.s here is your code with the addition of the lines that send the arrays values to the message log.
#include "sierrachart .h"
SCDLLName("KORELACE")
/*=============================================*/
SCSFExport scsf_korelace(SCStudyInterfaceRef sc)
{
SCSubgraphRef CC1 = sc.Subgraph[0];
SCInputRef InputArray1 = sc.Input[0];
SCInputRef InputArray2 = sc.Input[1];
SCInputRef Length = sc.Input[6];
if(sc.SetDefaults)
{
sc.GraphName = "KORELACE";
sc.GraphRegion = 1;
CC1.Name = "CC1";
CC1.DrawStyle = DRAWSTYLE_LINE;
CC1.PrimaryColor = RGB(255,0,0);
CC1.DrawZeros = true;
InputArray1.Name = "CC1 - Instrument 1";
InputArray1.SetChartStudySubgraphValues(1, 0, 0);
InputArray2.Name = "CC1 - Instrument 2";
InputArray2.SetChartStudySubgraphValues(1, 0, 0);
Length.Name = "Interval";
Length.SetInt(200);
sc.AutoLoop = 1;
sc.FreeDLL = 1;
sc.CalculationPrecedence = LOW_PREC_LEVEL;
return;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Definovani Poli Pro Prevzeti Dat z Externich Grafu
sc.DataStartIndex = Length.GetInt();
SCFloatArray pole1;
sc.GetStudyArrayFromChartUsingID(InputArray1.GetChartStudySubgraphValues(), pole1);
if(pole1.GetArraySize() < sc.ArraySize)
return;
SCFloatArray pole2;
sc.GetStudyArrayFromChartUsingID(InputArray2.GetChartStudySubgraphValues(), pole2);
if(pole2.GetArraySize() < sc.ArraySize)
return;
SCString str;
str.Format("NYSE_ Tick = %f ------ SP Tick = %f",pole1[sc.Index], pole2[sc.Index]);
sc.AddMessageToLog(str, 0);
CC1[sc.Index] = sc.GetCorrelationCoefficient(pole1, pole2, Length.GetInt());
}
Attached Files
Elite Membership required to download: KORELACE_Arrays.txt
February 27th, 2017, 10:21 AM
CZECH REPUBLIC
Posts: 24 since Nov 2015
Thanks Given: 1
Thanks Received: 0
Code
#include "c:\uziv\trade\1510\ACS_Source\sierrachart.h"
SCDLLName("KORELACE")
/*==========================================================================*/
SCSFExport scsf_korelace(SCStudyInterfaceRef sc)
{
SCSubgraphRef CC1 = sc.Subgraph[0];
SCInputRef InputArray1 = sc.Input[0];
SCInputRef InputIndex = sc.Input[1];
SCInputRef Length = sc.Input[3];
if(sc.SetDefaults)
{
sc.GraphName = "KORELACE";
sc.GraphRegion = 1;
CC1.Name = "CC1";
CC1.DrawStyle = DRAWSTYLE_LINE;
CC1.PrimaryColor = RGB(255,0,0);
CC1.DrawZeros = true;
InputArray1.Name = "Instrument 1";
InputArray1.SetChartNumber(1);
InputIndex.Name = "Input Index";
InputIndex.SetInputDataIndex(SC_LAST);
Length.Name = "Interval";
Length.SetInt(200);
sc.AutoLoop = 1;
sc.FreeDLL = 1;
sc.CalculationPrecedence = LOW_PREC_LEVEL;
return;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Definovani Poli Pro Prevzeti Dat z Externich Grafu
sc.DataStartIndex = Length.GetInt();
SCFloatArray pole1;
sc.GetChartArray(-InputArray1.GetChartNumber(), InputIndex.GetInputDataIndex(), pole1 );
int Chart1Index = sc.GetNearestMatchForDateTimeIndex(InputArray1.GetChartNumber(), sc.Index);
//CC1[sc.Index] = pole1[Chart1Index];
CC1[sc.Index] = sc.GetCorrelationCoefficient(pole1[Chart1Index], sc.BaseDataIn[SC_LAST] , Length.GetInt());
}
------
I got a problem with make this function work ......
error C2664: 'float s_sc::GetCorrelationCoefficient(SCFloatArrayRef,SCFloatArrayRef,int)' : cannot convert parameter 1 from 'float' to 'SCFloatArrayRef'
Howto get a correlation coefficient from basedata and referenced sc_last ..... ?
Thanks a lot
dave
March 17th, 2017, 07:56 PM
Columbus, OH
Experience: Intermediate
Platform: SierraChart
Trading: CL
Posts: 35 since May 2013
Thanks Given: 153
Thanks Received: 24
If you delete this [Chart1Index] from your function call it should compile.
The last line should read sc.GetCorrelationCoefficient(pole1, sc.BaseDataIn[SC_LAST] , Length.GetInt());
Last Updated on March 17, 2017