Skip to content

Commit f89b999

Browse files
committed
up
1 parent f844b36 commit f89b999

12 files changed

Lines changed: 10954 additions & 0 deletions

ACSILCustomChartBars.h

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
#ifndef ACSIL_CUSTOM_CHART_BARS_H
2+
#define ACSIL_CUSTOM_CHART_BARS_H
3+
4+
5+
struct s_CustomChartBarInterface
6+
{
7+
8+
public:
9+
s_CustomChartBarInterface();
10+
11+
//All of the following are Input members
12+
ChartDataTypeEnum ChartDataType = NO_DATA_TYPE;//Indicates if this chart is based on historical Daily data or Intraday data.
13+
unsigned char IsDeterminingIfShouldStartNewBar = 0;//1 = if the custom bar building function needs to indicate if should start a new chart bar. Otherwise, it is 0.
14+
unsigned char IsFinalProcessingAfterNewOrCurrentBar = 0;
15+
unsigned char IsInsertFileRecordsProcessing = 0;
16+
17+
s_IntradayRecord NewFileRecord;
18+
uint32_t CurrentBarIndex = 0;
19+
int32_t ValueFormat = 0;
20+
unsigned char IsNewFileRecord = 0;
21+
unsigned char BarHasBeenCutAtStartOfSession = 0;
22+
unsigned char IsNewChartBar = 0;
23+
unsigned char IsFirstBarOfChart = 0;//1 = When the first bar of the chart
24+
float TickSize = 0.0f;
25+
26+
//The following are Output members
27+
unsigned char StartNewBarFlag = 0;//Set to 1 to start a new chart bar. In this case NewFileRecord becomes part of the new chart bar.
28+
unsigned char InsertNewRecord = 0;
29+
s_IntradayRecord NewRecordToInsert;
30+
31+
// Functions
32+
33+
float& GetChartBarValue(int SubgraphIndex, int BarIndex);
34+
const SCDateTime& GetChartBarDateTime(int BarIndex);
35+
SCInputRef& GetInput(int InputIndex);
36+
37+
int& GetPersistentInt(int Key);
38+
float& GetPersistentFloat(int Key);
39+
double& GetPersistentDouble(int Key);
40+
int64_t& GetPersistentInt64(int Key);
41+
SCDateTime& GetPersistentSCDateTime(int Key);
42+
void SetLoadingDataObjectPointer(void* p_LoadingDataObject)
43+
{
44+
m_p_LoadingDataObject = p_LoadingDataObject;
45+
}
46+
47+
int FormattedEvaluate(float Value1, unsigned int Value1Format,
48+
OperatorEnum Operator,
49+
float Value2, unsigned int Value2Format,
50+
float PrevValue1, float PrevValue2,
51+
int* CrossDirection);
52+
53+
void AddMessageToLog(const char* MessageText, int ShowLog);
54+
55+
private:
56+
float& (SCDLLCALL* Internal_GetChartBarValue)(void* p_LoadingDataObject, int SubgraphIndex, int BarIndex);
57+
const SCDateTime& (SCDLLCALL*Internal_GetChartBarDateTime)(void* p_LoadingDataObject, int BarIndex);
58+
SCInputRef & (SCDLLCALL*Internal_GetInput)(void* p_LoadingDataObject, int InputIndex);
59+
60+
int& (SCDLLCALL* Internal_GetPersistentInt)(void* p_LoadingDataObject, int Key);
61+
float& (SCDLLCALL* Internal_GetPersistentFloat)(void* p_LoadingDataObject, int Key);
62+
double& (SCDLLCALL* Internal_GetPersistentDouble)(void* p_LoadingDataObject, int Key);
63+
int64_t& (SCDLLCALL* Internal_GetPersistentInt64)(void* p_LoadingDataObject, int Key);
64+
SCDateTime& (SCDLLCALL* Internal_GetPersistentSCDateTime)(void* p_LoadingDataObject, int Key);
65+
66+
void* m_p_LoadingDataObject = nullptr;
67+
68+
public:
69+
//Additional Input members
70+
float BidPrice = 0.0f;//The bid price associated with the last trade in NewFileRecord
71+
float AskPrice = 0.0f;//The ask price associated with the last trade in NewFileRecord
72+
73+
const c_VAPContainer *VolumeAtPriceForBars = nullptr;
74+
75+
private:
76+
int (SCDLLCALL* InternalFormattedEvaluate)(float Value1, unsigned int Value1Format,
77+
OperatorEnum Operator,
78+
float Value2, unsigned int Value2Format,
79+
float PrevValue1, float PrevValue2,
80+
int* CrossDirection) = nullptr;
81+
82+
public:
83+
//Additional Input members
84+
uint64_t NewFileRecordIndex = UINT64_MAX;
85+
int IsBeginBarBuilding = 0;
86+
int IsLoading = 0;
87+
88+
private:
89+
void (SCDLLCALL* InternalAddMessageToLog)(const char* MessageText, int ShowLog);
90+
};
91+
92+
/*==========================================================================*/
93+
inline float& s_CustomChartBarInterface::GetChartBarValue(int SubgraphIndex, int BarIndex)
94+
{
95+
return Internal_GetChartBarValue(m_p_LoadingDataObject, SubgraphIndex, BarIndex);
96+
}
97+
/*==========================================================================*/
98+
inline const SCDateTime& s_CustomChartBarInterface::GetChartBarDateTime(int BarIndex)
99+
{
100+
return Internal_GetChartBarDateTime(m_p_LoadingDataObject, BarIndex);
101+
}
102+
/*==========================================================================*/
103+
inline SCInputRef& s_CustomChartBarInterface::GetInput(int InputIndex)
104+
{
105+
return Internal_GetInput(m_p_LoadingDataObject, InputIndex);
106+
}
107+
/*==========================================================================*/
108+
109+
inline int& s_CustomChartBarInterface::GetPersistentInt( int Key)
110+
{
111+
return Internal_GetPersistentInt(m_p_LoadingDataObject, Key);
112+
}
113+
/*==========================================================================*/
114+
inline float& s_CustomChartBarInterface::GetPersistentFloat(int Key)
115+
{
116+
return Internal_GetPersistentFloat(m_p_LoadingDataObject, Key);
117+
118+
}
119+
/*==========================================================================*/
120+
inline double& s_CustomChartBarInterface::GetPersistentDouble(int Key)
121+
{
122+
return Internal_GetPersistentDouble(m_p_LoadingDataObject, Key);
123+
124+
}
125+
/*==========================================================================*/
126+
inline int64_t& s_CustomChartBarInterface::GetPersistentInt64(int Key)
127+
{
128+
return Internal_GetPersistentInt64(m_p_LoadingDataObject, Key);
129+
}
130+
131+
/*==========================================================================*/
132+
inline SCDateTime& s_CustomChartBarInterface::GetPersistentSCDateTime(int Key)
133+
{
134+
return Internal_GetPersistentSCDateTime(m_p_LoadingDataObject, Key);
135+
}
136+
137+
/*==========================================================================*/
138+
inline int s_CustomChartBarInterface::FormattedEvaluate
139+
(float Value1, unsigned int Value1Format,
140+
OperatorEnum Operator,
141+
float Value2, unsigned int Value2Format,
142+
float PrevValue1, float PrevValue2,
143+
int* CrossDirection)
144+
{
145+
return InternalFormattedEvaluate(Value1, Value1Format, Operator, Value2, Value2Format, PrevValue1, PrevValue2, CrossDirection);
146+
}
147+
148+
/*==========================================================================*/
149+
inline void s_CustomChartBarInterface::AddMessageToLog(const char* MessageText, int ShowLog)
150+
{
151+
InternalAddMessageToLog(MessageText, ShowLog);
152+
}
153+
154+
/*==========================================================================*/
155+
typedef s_CustomChartBarInterface& SCCustomChartBarInterfaceRef;
156+
157+
typedef void (SCDLLCALL* fp_ACSCustomChartBarFunction)(SCCustomChartBarInterfaceRef);
158+
159+
#endif

0 commit comments

Comments
 (0)