使用指南
Examples of indicators usage
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
Examples of indicators usage
Example 1. Displaying three lines of the Alligator indicator.
extern int ExtCountedBars=0; extern int JawsPeriod=13; extern int JawsShift=8; extern int TeethPeriod=8; extern int TeethShift=5; extern int LipsPeriod=5; extern int LipsShift=3; double ExtMapBuffer[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; extern int MA_Period = 3; extern int ma_method = 0; extern int ma_shift = 0; extern int applied_price = 0; int Initialize() { Indicator.SetIndexCount(3); Indicator.SetIndexDrawStart(0,JawsPeriod-1); Indicator.SetIndexDrawStart(1,TeethPeriod-1); Indicator.SetIndexDrawStart(2,LipsPeriod-1); Indicator.SetIndexBuffer(0,ExtMapBuffer); Indicator.SetIndexBuffer(1,ExtMapBuffer2); Indicator.SetIndexBuffer(2,ExtMapBuffer3); Indicator.SetIndexStyle(0,0,0,1,0xFF0000); Indicator.SetIndexStyle(1,0,0,1,0x00FF00); Indicator.SetIndexStyle(2,0,0,1,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() { int pos=Chart.Bars-ExtCountedBars-1; while(pos>=0) { ExtMapBuffer[pos]=Indicators.Alligator(Chart.Symbol,Chart.Interval,JawsPeriod,JawsShift,TeethPeriod,TeethShift,LipsPeriod,LipsShift,ma_method,applied_price,0,pos); ExtMapBuffer2[pos]=Indicators.Alligator(Chart.Symbol,Chart.Interval,JawsPeriod,JawsShift,TeethPeriod,TeethShift,LipsPeriod,LipsShift,ma_method,applied_price,1,pos); ExtMapBuffer3[pos]=Indicators.Alligator(Chart.Symbol,Chart.Interval,JawsPeriod,JawsShift,TeethPeriod,TeethShift,LipsPeriod,LipsShift,ma_method,applied_price,2,pos); pos--; } }
Output:
Example 2. Displaying the histogram of the Awesome Oscillator indicator in a separate window.
#set_indicator_separate double ExtMapBuffer[]; double ExtMapBuffer2[]; int ExtCountedBars=0; int Initialize() { Indicator.SetIndexCount(2); Indicator.SetIndexBuffer(0,ExtMapBuffer); Indicator.SetIndexStyle(0,2,0,2,0xFF0000); Indicator.SetIndexBuffer(1,ExtMapBuffer2); Indicator.SetIndexStyle(1,2,0,2,0xFF0000); Indicator.SetDigits(1); 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() { int pos=Chart.Bars-ExtCountedBars-1; while(pos>=0) { ExtMapBuffer[pos]=Indicators.AO(Chart.Symbol,Chart.Interval,pos); ExtMapBuffer2[pos]=0; pos--; } }
Output: