Login Page - Create Account

Support Board


Date/Time: Tue, 07 May 2024 11:53:26 +0000



Trouble pulling SMI from other charts

View Count: 1145

[2015-07-10 17:47:40]
User424542 - Posts: 6
I'm building a bot that needs to pull the SMI value from the Stochastic Momentum Indicator of two other charts. Chart 1 and chart 3. My bot sits on chart 2. On each chart, the SMI is ID: 1.

From chart 2 where the bot sits, it can easily pull the correct value using the following code:

SCFloatArray StudyPosiedon;
sc.GetStudyArrayFromChartUsingID(2, 1, 0, StudyPosiedon);

When I replace the 2 with a 1 or 3 (yes, I checked the charts to make sure of the chart #s), chart 1 gave nothing, and chart 3 gave values that don't match anything I can see. Definitely not an ES price value, and I cant see any values on the SMI that report a value of 90.097.

Any idea what is wrong in my code? Is there a better way to pull that value from other charts?

Thanks :)
[2015-07-10 17:58:11]
Sierra Chart Engineering - Posts: 104368
You need to be aware that the array sizes are different with charts 1 and 3 compared to 2, so you need to be able to find the corresponding index in the study Subgraph array you are getting, which corresponds to chart 2.

Refer to the documentation here:
https://www.sierrachart.com/index.php?page=doc/doc_ACSILRefOtherTimeFrames.php
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2015-07-10 18:08:53
[2015-07-10 18:02:33]
User424542 - Posts: 6
You mean the subgraph array inside the SMI? Playing around with it a bit, I figured out that it is subgraph 0.
[2015-07-10 18:09:08]
Sierra Chart Engineering - Posts: 104368
Yes. This is correct.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2015-07-10 18:17:47]
User424542 - Posts: 6
I just need to know the last 3 values of the SMI of other charts. I don't actually need to draw it. What should I use to just retrieve those values for use in calculations?
[2015-07-10 18:28:34]
User424542 - Posts: 6
I've updated the code to the following, trying to capture values from another chart. It sees them on the study calculation when I hit Apply, but than proceeds to give nothing but 0s in the message log.


  SCFloatArray StudyPosiedon;
  sc.GetStudyArrayFromChartUsingID(1, 2, 0, StudyPosiedon);
  float fishFood = StudyPosiedon[sc.Index];

  Posiedon3[sc.Index] = StudyPosiedon[sc.Index];

  SCString BufferOne;
  BufferOne.Format("Current value: %f", fishFood);
  sc.AddMessageToLog(BufferOne, 0);

Date Time Of Last Edit: 2015-07-10 18:28:49
[2015-07-10 18:56:27]
Sierra Chart Engineering - Posts: 104368
Here is code to get the very last value of the study Subgraph:

if (StudyPosiedon.GetArraySize() == 0)
return;

float LastValue = StudyPosiedon[StudyPosiedon.GetArraySize() -1];

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account