دليل المستخدم
Timeseries
NetTradeX PC
NetTradeX Android
NetTradeX iOS
NetTradeX Mobile
NetTradeX Advisors
-
User Guide for NTTX Advisors
- NetTradeX Advisors Terminal
-
Articles
-
NetTradeX Language: Introduction
- Language Basics
- Language Functions
-
Language System Objects
- Deal Management
- Order Management
- Indicators
- Object-Oriented Programming
-
DLL files
-
Object Account
-
Object Bars
-
Object Chart
-
Object datetime
-
Object History
-
Object file
-
Object Globals
-
Object Math
-
Object Symbols
-
Object System
Timeseries
There are special timeseries arrays to operate historic bars in NetTradeX language. The peculiarity of these arrays - reverse indexing : the last element has the index 0, the penultimate is 1, etc. The array names are predefined so the programmer does not need to declare them.
The following timeseries arrays can be used:
- Open - opening bar price
- High - maximum bar price
- Low - minimum bar price
- Close - closing bar price
- Time - opening bar time
- Volume - tick volume of a bar
Example. Let us find minimum and maximum values of all the bars for the last hour and show the corresponding lines on the chart:
int ExtCountedBars = 0; double ExtMapBuffer1[]; double ExtMapBuffer2[]; int Initialize() { Indicator.SetIndexCount(2); Indicator.SetIndexBuffer(0,ExtMapBuffer1); Indicator.SetIndexStyle(0,0,0,2,0xFF0000); Indicator.SetIndexBuffer(1,ExtMapBuffer2); Indicator.SetIndexStyle(1,0,0,2,0x0000FF); return(0); } int Run() { ExtCountedBars=Indicator.Calculated; if (ExtCountedBars<0) { System.Print("Error"); return(-1); } if (ExtCountedBars>0) ExtCountedBars--; draw(); return(0); } int DeInitialize() { return(0); } void draw() { double high = High[0]; double low = Low[0]; datetime currentTime = System.Time; for(int i=0; i<Chart.Bars && ((Time[i]+3600)>currentTime); i++) { if(High[i]>high) { high = High[i]; } if(Low[i]<low) { low = Low[i]; } } int pos=Chart.Bars-1; while(pos>=0) { ExtMapBuffer1[pos]=high; ExtMapBuffer2[pos]=low; pos--; } }