Login Page - Create Account

Support Board


Date/Time: Sun, 22 Dec 2024 05:26:23 +0000



[User Discussion] - Plot ifstream value into horizontal line

View Count: 979

[2015-04-02 05:58:00]
Benevolent - Posts: 4
Hello all,

I am attempting to populate a value via ifstream within SC. To make things a bit more complicated, I am attempting to grab the value via http. When the value is received, I am attempting to have the value represented by a basic horizontal line (similar to a "target" mentality). However, the code which I have found below is giving me this error:

error: expected unqualified-id before '(' token
#define min(a,b) (((a) < (b)) ? (a) : (b))

// The top of every source code file must include this line
#include "sierrachart.h"
#include <fstream>
#include <iostream>


/*****************************************************************************

  For reference, please refer to the Advanced Custom Study Interface
  and Language documentation on the Sierra Chart website.
  
*****************************************************************************/


// This line is required. Change the text within the quote
// marks to what you want to name your group of custom studies.
using namespace std;
SCDLLName("EURUSD_Target")


//This is the basic framework of a study function.
SCSFExport scsf_SkeletonFunction(SCStudyGraphRef sc)
{
  // Section 1 - Set the configuration variables and defaults
  if (sc.SetDefaults)
  {
    sc.GraphName = "EURUSD_Target";
    
    // During development set this flag to 1, so the DLL can be rebuilt without restarting Sierra Chart. When development is completed, set it to 0 to improve performance.
    sc.FreeDLL = 1;

    sc.AutoLoop = 1; //Auto looping is enabled.
    
    sc.Subgraph[0].Name = "EURUSD_Target";
    sc.Subgraph[0].DrawStyle = DRAWSTYLE_LINE;
    sc.Subgraph[0].PrimaryColor = RGB (0, 255, 0);
    
    sc.Input[0].Name = "Float Input";
    sc.Input[0].SetFloat(0.0f);
    
    return;
  }
  
int myfileopen = 1;  
  ifstream reader( "mysite/Targets/EURUSD_Target.txt" ) ;
  if ( myfileopen == 0 )
  {
   int myfileopen = 1 ;

if ( ! reader )
{
cout << "Error opening input file" << endl ;
//return -1 ;
}
  
  }
}

Any suggestions on how to receive this data as a string in which SC can work with correctly?

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

Login

Login Page - Create Account