Login Page - Create Account

Support Board


Date/Time: Sat, 23 Nov 2024 12:05:23 +0000



[User Discussion] - Price/Study Overlay study question

View Count: 2381

[2013-06-07 04:29:42]
ticktrader - Posts: 5
I have two charts one 30 ticks (receiving) and another 20 ticks (sending). I have an study in the sending chart that I want to draw onto the receiving chart. I use the "Price/Study Overlay" study for this. The problem is that not all the points are drawn in the receiving chart.
I have played with the parameters of the study and I found that changing:
"Data Copy Mode" between the values "Use Earliest Value from ..." and "Use Latest Value from ..." I get different points drawn in the receiving chart. So I use two of those studies and I set the "Data Copy Mode" on each differently. I finally got all the points drawn.
I look for the code of the study but I could not find it. Could make it available? Otherwise could you add a third option to parameter "Data Copy Mode" that would use both options?

thanks
[2013-06-07 04:57:04]
ticktrader - Posts: 5
Here is a picture of what I see. The yellow or pink arrows are projection of the sending chart onto the receiving chart.
image6-7-2013 12-54-58 AM.png / V - Attached On 2013-06-07 04:56:04 UTC - Size: 17.92 KB - 641 views
[2013-06-07 21:55:14]
Sierra Chart Engineering - Posts: 104368
The source code is not available. It does not make technical sense to add the kind of option that you ask for.
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
[2013-06-09 20:28:34]
ticktrader - Posts: 5
My question has not been answered and I posted some additional information about my question. Can you please answer the question?
[2013-06-10 21:51:49]
Sierra Chart Engineering - Posts: 104368
We have answered the questions. Refer to post #3. We do not see how we can help further with this.
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
[2013-06-12 05:51:50]
TastyRisk - Posts: 119
Try this: it will combine the data from two studies.

I made it to use the open of study#1, and the "fill blank" data from study#2. This is the choice in "auto mode"; but if you choose "N= non auto select" in the settings; then you can combine your two overlays which each have different settings.

It might work for you?... It will try to use the data from study #1. If that data array is empty then it will take the data from study #2. For sure you must "fill blanks" on your second input study.

See picture below about study #1 & study #2.



#include "sierrachart.h"

SCDLLName("Studies951")

SCSFExport scsf_OverlaysCombinedMultiplier(SCStudyInterfaceRef sc)
{
  SCSubgraphRef StudyValue = sc.Subgraph[0];

  SCInputRef Stdy1 = sc.Input[0];
  SCInputRef Stdy2 = sc.Input[1];
  SCInputRef PreviousStudies = sc.Input[2];
  SCInputRef DrawZeros = sc.Input[3];
  SCInputRef Multiplier = sc.Input[4];

  
  SCFloatArray Study1Array;
  SCFloatArray Study2Array;

  if (sc.SetDefaults)
  {
    sc.GraphName = "OverlaysCombinedMultiplier";
    
    sc.StudyDescription = "//// Two studies should be applied before this one; Study Overlay OHLC & Study/Price Overlay. //// This study will show the Open of the first study. However; If there is no current trade data for this chart -then the last trade data from the second study is used instead. //// Choosing Auto Select Studies = Yes will automatically select the two studies prior to this one & use SG1 OPEN. i.e If this Study has ID:8, then 6&7 are automatically used. Choose free selction if you want to use data other than SG1 OPEN. ////";

    sc.AutoLoop = 1;

    sc.FreeDLL = 0;

    StudyValue.Name = "StudyValue";
    StudyValue.DrawStyle = DRAWSTYLE_LINE;
    StudyValue.LineWidth = 1;
    
    Stdy1.Name = "Input Study `Study Overlay OHLC`";
    Stdy1.SetStudySubgraphValues(1, 0);

    Stdy2.Name = "Input Study `Study/Price Overlay`";
    Stdy2.SetStudySubgraphValues(2, 0);

    PreviousStudies.Name = "Auto Select Studies = Y. No Auto - free Selection = N";
    PreviousStudies.SetYesNo(true);;

    DrawZeros.Name = "Draw Zeros";
    DrawZeros.SetYesNo(true);

    Multiplier.Name = "Multiplier";
    Multiplier.SetFloat(1.0f);

    return;
  }

  int i = sc.Index;
  int ID0 = sc.StudyGraphInstanceID;
  
  if (PreviousStudies.GetYesNo())
  {
    int ID1 = (ID0 -2);
    int ID2 = (ID0 -1);
    int val = 0;

    Stdy1.SetStudySubgraphValues(ID1,val);
    Stdy2.SetStudySubgraphValues(ID2,val);

    sc.GetStudyArrayUsingID(Stdy1.GetStudyID(),Stdy1.GetSubgraphIndex(),Study1Array);
    sc.GetStudyArrayUsingID(Stdy2.GetStudyID(),Stdy2.GetSubgraphIndex(),Study2Array);
  
    if (Study1Array[i] == 0)
    {
    Study1Array[i] = Study2Array[i];
    }
  }
  
  else
  {
    sc.GetStudyArrayUsingID(Stdy1.GetStudyID(),Stdy1.GetSubgraphIndex(),Study1Array);
    sc.GetStudyArrayUsingID(Stdy2.GetStudyID(),Stdy2.GetSubgraphIndex(),Study2Array);
  
    if (Study1Array[i] == 0)
    {
    Study1Array[i] = Study2Array[i];
    }
  }
  
  if (ID0 <= 2) {return;}
  else
  
  StudyValue.DrawZeros = DrawZeros.GetYesNo();
  StudyValue[i] = Study1Array[i] * Multiplier.GetFloat();
}


Date Time Of Last Edit: 2013-06-12 06:16:36
[2013-06-12 06:04:57]
TastyRisk - Posts: 119
see pic for settings.
imageexample564fd168vt48.png / V - Attached On 2013-06-12 06:04:40 UTC - Size: 63.01 KB - 559 views
[2013-06-29 00:03:31]
ticktrader - Posts: 5
TastyRisk:
Thanks for your answer and sharing your code. However that just works for studies in the same chart. I however need to read data from another chart in a different time frame. The challenge there is that bars between the chart don't align. My guess is that is why SC has many options in that particular study. However I need to add two studies and set the option values to "Use Earliest Value from ..." and "Use Latest Value from ..." to be able to get all the signals from the second chart.
The issue lies in the call to:
sc->GetNearestMatchForDateTimeIndex(m_ChartNumber, index)
that returns the equivalent index from the second chart that matches the first chart.
There is another parameter "Bar Time Maching metod" which I don't know what it does. Ideally I would like to code this in a single chart.

However the support here I getting worst. I used to get answers reponded in the same day.
[2013-06-29 00:17:13]
Sierra Chart Engineering - Posts: 104368
You will not get any responses in this thread from us because it is marked as a User Discussion, and we did respond, that your request simply makes no sense based upon how the study works. What you are looking for is not possible with the design of that study. It also does not make any sense to us and you are asking for something which is very confusing and unstructured.

All of the study inputs for the Study/Price Overlay study are thoroughly documented.
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: 2013-06-29 00:19:35
[2013-06-30 18:25:25]
TastyRisk - Posts: 119
I think you should take another look at my custom study.

Yes, it will use study data from another chart...

You need to overlay the same study twice before adding my custom study.

The first overlay will contain your "Use Earliest Value from ..." data.

The second overlay will contain your "Use Latest Value from ..." data.


My custom study, provided in code already, will then read data from the two overlays. It will always fill the blanks if no value exists in the first study. Perhaps you'd want the first study set to "latest" and second to "earliest" depending on your usage.

It's working for me although glitchs do occur on sub-second overlayed arrays but that's not something that can be fixed without a change in how SC time-stamps data.
Date Time Of Last Edit: 2013-06-30 18:36:26

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

Login

Login Page - Create Account