Login Page - Create Account

Support Board


Date/Time: Tue, 07 May 2024 07:49:43 +0000



Post From: How do I reference spreadsheet values from a custom study?

[2013-08-13 03:40:38]
Bedhog - Posts: 168
Hello All,

I would like to draw some horizontal lines on a chart.

All of the values I want to work with are in a spreadsheet. Can someone point me to the documentation on referencing spreadsheet data from a custom study? I could also use a hand with the 'if then' structure as shown.

I was able to start this project using the sample line drawing found here
sc.Subgraph[0].Name = "Line";
sc.Subgraph[0].DrawStyle = DRAWSTYLE_LINE;
sc.Subgraph[0].PrimaryColor = RGB(0,255,0); // green
sc.Subgraph[0].LineWidth = 5;  
sc.Input[0].Name = "Line Value";
sc.Input[0].SetFloat(50); // default value
sc.Input[0].SetFloatLimits(1, 20000); // min-max value

However, I would like to pull the the colors and the values from a spreadsheet.

Line Value = SpreadsheetReference // '8Range'!AO3

If Spreadsheet1.!tabname.BL3 = 1 // '8Range'!AZ3
then Line Color = RGB(0,255,0); //green
Else If Spreadsheet1.!tabname.BM3 = 1
then Line Color = RGB(255,0,0); //red
Else If Spreadsheet1.!tabname.BN3 = 1
then Line Color = RGB(255,255,255); //white
End

Thank you.