IndicatorBuffers ()
IndicatorCounted ()
IndicatorDigits ()
IndicatorShortName ()
SetIndexArrow ()
SetIndexBuffer ()
SetIndexDrawBegin ()
SetIndexEmptyValue ()
SetIndexLabel ()
SetIndexShift ()
SetIndexStyle ()
void IndicatorBuffers (int count)
Allocated memory buffers used for custom indicator calculations. It can not be greater than 8 and less than indicator_buffers property. If you own indicator requires additional buffers for counting then use this function for pointing out common buffers count.
Parameters
count - count buffers to allocate. It should be up to 8 buffers.
Sample
# Ownership indicator_separate_window
Ownership indicator_buffers # 1
# Ownership indicator_color1 Silver
//---- Indicator parameters
extern int FastEMA = 12;
extern int SlowEMA = 26;
extern int SignalSMA = 9;
//---- Indicator buffers
double ind_buffer1 [];
double ind_buffer2 [];
double ind_buffer3 [];
//+----------------------------------------------- -------------------+
/ / | Custom indicator initialization function |
//+----------------------------------------------- -------------------+
int init ()
{
//---- 2 additional buffers are used for counting.
IndicatorBuffers (3);
//---- Draw settings
SetIndexStyle (0, DRAW_HISTOGRAM, STYLE_SOLID, 3);
SetIndexDrawBegin (0, SignalSMA);
IndicatorDigits (MarketInfo (Symbol (), MODE_DIGITS) 2);
//---- 3 indicator buffers mapping
SetIndexBuffer (0, ind_buffer1);
SetIndexBuffer (1, ind_buffer2);
SetIndexBuffer (2, ind_buffer3);
//---- Name for DataWindow and indicator subwindow label
IndicatorShortName ("OSMA (" + FastEMA +","+ SlowEMA +","+ SignalSMA +")");
//---- Initialization done
return (0);
}
int IndicatorCounted ()
Returns bars deemed not changed since the last indicator launch. In most cases the same number of index values do not need calculation. Used to optimize calculations.
Sample
int start ()
{
int limit;
int counted_bars = IndicatorCounted ();
//---- Check for possible errors
if (counted_bars <0) return (-1);
//---- Last counted bar will be recounted
if (counted_bars> 0) counted_bars -;
limit = Bars-counted_bars;
//---- Main loop
for (int i = 0; i
//---- Ma_shift set to 0, because SetIndexShift called abowe
ExtBlueBuffer [i] = IMA (NULL, 0, JawsPeriod, 0, MODE_SMMA, PRICE_MEDIAN, i);
ExtRedBuffer [i] = IMA (NULL, 0, TeethPeriod, 0, MODE_SMMA, PRICE_MEDIAN, i);
ExtLimeBuffer [i] = IMA (NULL, 0, LipsPeriod, 0, MODE_SMMA, PRICE_MEDIAN, i);
}
//---- Creator
return (0);
}
void IndicatorDigits (int digits)
Sets the default format for precision indicators visualization.
Parameters
digits - Precision format, number of digits Mon decimal point.
Sample
# Ownership indicator_separate_window
Ownership indicator_buffers # 1
# Ownership indicator_color1 Silver
//---- Indicator parameters
extern int FastEMA = 12;
extern int SlowEMA = 26;
extern int SignalSMA = 9;
//---- Indicator buffers
double ind_buffer1 [];
double ind_buffer2 [];
double ind_buffer3 [];
//+----------------------------------------------- -------------------+
/ / | Custom indicator initialization function |
//+----------------------------------------------- -------------------+
int init ()
{
//---- 2 additional buffers are used for counting.
IndicatorBuffers (3);
//---- Draw settings
SetIndexStyle (0, DRAW_HISTOGRAM, STYLE_SOLID, 3);
SetIndexDrawBegin (0, SignalSMA);
IndicatorDigits (MarketInfo (Symbol (), MODE_DIGITS) 2);
//---- 3 indicator buffers mapping
SetIndexBuffer (0, ind_buffer1);
SetIndexBuffer (1, ind_buffer2);
SetIndexBuffer (2, ind_buffer3);
//---- Name for DataWindow and indicator subwindow label
IndicatorShortName ("OSMA (" + FastEMA +","+ SlowEMA +","+ SignalSMA +")");
//---- Initialization done
return (0);
}
void IndicatorShortName (string name)
Sets indicator short name subwindow for displaying the table is.
Parameters
name - new short name.
Sample
# Ownership indicator_separate_window
Ownership indicator_buffers # 1
# Ownership indicator_color1 Silver
//---- Indicator parameters
extern int FastEMA = 12;
extern int SlowEMA = 26;
extern int SignalSMA = 9;
//---- Indicator buffers
double ind_buffer1 [];
double ind_buffer2 [];
double ind_buffer3 [];
//+----------------------------------------------- -------------------+
/ / | Custom indicator initialization function |
//+----------------------------------------------- -------------------+
int init ()
{
//---- 2 additional buffers are used for counting.
IndicatorBuffers (3);
//---- Draw settings
SetIndexStyle (0, DRAW_HISTOGRAM, STYLE_SOLID, 3);
SetIndexDrawBegin (0, SignalSMA);
IndicatorDigits (MarketInfo (Symbol (), MODE_DIGITS) 2);
//---- 3 indicator buffers mapping
SetIndexBuffer (0, ind_buffer1);
SetIndexBuffer (1, ind_buffer2);
SetIndexBuffer (2, ind_buffer3);
//---- Name for DataWindow and indicator subwindow label
IndicatorShortName ("OSMA (" + FastEMA +","+ SlowEMA +","+ SignalSMA +")");
//---- Initialization done
return (0);
}
void SetIndexArrow (int index, int code)
Sets arrow symbol indicators that draws some lines as an arrow.
Parameters
index - the line index. Should be 0-7.
code - code symbol Wingdings font or string constants.
Sample
SetIndexArrow (0, 217);
bool SetIndexBuffer (int index, double array [])
Set buffer for calculating line. Specify a string tied to the previously assigned its own indicator buffer. If the function succeeds, the return value is true. If the function does, the return value is false. To get extended error information, call GetLastError ().
Parameters
index - the line index. Should be 0-7.
string [] - array that stores calculated indicator values.
Sample
double ExtBufferSilver [];
int init ()
{
SetIndexBuffer (0, ExtBufferSilver); / / set the buffer for the first line
/ / ...
}
void SetIndexDrawBegin (int index, int start)
Sets the first bar of what index will be drawn. Index values begin to prepare are not significant and not ready and did not show in the DataWindow.
Parameters
index - the line index. Should be 0-7.
start - first drawing bar position number.
Sample
# Ownership indicator_separate_window
Ownership indicator_buffers # 1
# Ownership indicator_color1 Silver
//---- Indicator parameters
extern int FastEMA = 12;
extern int SlowEMA = 26;
extern int SignalSMA = 9;
//---- Indicator buffers
double ind_buffer1 [];
double ind_buffer2 [];
double ind_buffer3 [];
//+----------------------------------------------- -------------------+
/ / | Custom indicator initialization function |
//+----------------------------------------------- -------------------+
int init ()
{
//---- 2 additional buffers are used for counting.
IndicatorBuffers (3);
//---- Draw settings
SetIndexStyle (0, DRAW_HISTOGRAM, STYLE_SOLID, 3);
SetIndexDrawBegin (0, SignalSMA);
IndicatorDigits (MarketInfo (Symbol (), MODE_DIGITS) 2);
//---- 3 indicator buffers mapping
SetIndexBuffer (0, ind_buffer1);
SetIndexBuffer (1, ind_buffer2);
SetIndexBuffer (2, ind_buffer3);
//---- Name for DataWindow and indicator subwindow label
IndicatorShortName ("OSMA (" + FastEMA +","+ SlowEMA +","+ SignalSMA +")");
//---- Initialization done
return (0);
}
void SetIndexEmptyValue (int index, double value)
Sets drawing line empty value. The baseline value is empty EMPTY_VALUE. Empty values are not prepared and do not appear in DataWindow.
Parameters
index - the line index. Should be 0-7.
value - new empty value.
Sample
SetIndexEmptyValue (6,0.0001);
void SetIndexLabel (int index, string text)
Sets the description of line drawing shows the DataWindow.
Parameters
index - the line index. Should be 0-7.
text - Label text. NULL means that the index value does not appear in DataWindow.
Sample
//+----------------------------------------------- -------------------+
/ / | Ichimoku Kinko Hyo initialization function |
//+----------------------------------------------- -------------------+
int init ()
{
//----
SetIndexStyle (0, DRAW_LINE);
SetIndexBuffer (0, Tenkan_Buffer);
SetIndexDrawBegin (0, Tenkan-1);
SetIndexLabel (0, "Tenkan Saint");
//----
SetIndexStyle (1, DRAW_LINE);
SetIndexBuffer (1, Kijun_Buffer);
SetIndexDrawBegin (1, Kijun-1);
SetIndexLabel (1, "Kijun Saint");
//----
a_begin = Kijun, if (a_begin
SetIndexBuffer (2, SpanA_Buffer);
SetIndexDrawBegin (2, Kijun + a_begin-1);
SetIndexShift (2, Kijun);
//---- By Kumo bounding line does not show in the DataWindow
SetIndexLabel (2, NULL);
SetIndexStyle (5, DRAW_LINE, STYLE_DOT);
SetIndexBuffer (5, SpanA2_Buffer);
SetIndexDrawBegin (5, Kijun + a_begin-1);
SetIndexShift (5, Kijun);
SetIndexLabel (5, "Senkou Span A");
//----
SetIndexStyle (3, DRAW_HISTOGRAM, STYLE_DOT);
SetIndexBuffer (3, SpanB_Buffer);
SetIndexDrawBegin (3, Kijun + Senkou-1);
SetIndexShift (3, Kijun);
//---- Down Kumo bounding line does not appear in the DataWindow
SetIndexLabel (3, NULL);
//----
SetIndexStyle (6, DRAW_LINE, STYLE_DOT);
SetIndexBuffer (6, SpanB2_Buffer);
SetIndexDrawBegin (6, Kijun + Senkou-1);
SetIndexShift (6, Kijun);
SetIndexLabel (6, "Senkou Span B");
//----
SetIndexStyle (4, DRAW_LINE);
SetIndexBuffer (4, Chinkou_Buffer);
SetIndexShift (4,-Kijun);
SetIndexLabel (4, "Chinkou Span");
//----
return (0);
}
void SetIndexShift (int index, int shift)
Set up for drawing the line. The line will be considered on the current tape, but will be withdrawn are transferred.
Parameters
index - the line index. Should be 0-7.
change - Shitf value bars.
Sample
//+----------------------------------------------- -------------------+
/ / | Alligator initialization function |
//+----------------------------------------------- -------------------+
int init ()
{
//---- Line shifts when drawing
SetIndexShift (0, JawsShift);
SetIndexShift (1, TeethShift);
SetIndexShift (2, LipsShift);
//---- First positions skipped when drawing
SetIndexDrawBegin (0, + JawsShift JawsPeriod);
SetIndexDrawBegin (1, TeethShift + TeethPeriod);
SetIndexDrawBegin (2, LipsShift + LipsPeriod);
//---- 3 indicator buffers mapping
SetIndexBuffer (0, ExtBlueBuffer);
SetIndexBuffer (1, ExtRedBuffer);
SetIndexBuffer (2, ExtLimeBuffer);
//---- Draw settings
SetIndexStyle (0, DRAW_LINE);
SetIndexStyle (1, DRAW_LINE);
SetIndexStyle (2, DRAW_LINE);
//---- Index labels
SetIndexLabel (0 ", Gator Jaws");
SetIndexLabel (1, "Gator teeth");
SetIndexLabel (2, "Lips Gator");
//---- Initialization done
return (0);
}
void SetIndexStyle (int index, int type, int style = Empty, int width = Empty, Color CLR = CLR_NONE)
Sets a new type, style, width and color indicator pointed line.
Parameters
index - the line index. Should be 0-7.
type - shape style. You may be one of DRAW_LINE, DRAW_SECTION, DRAW_HISTOGRAM, DRAW_ARROW.
style - drawing style. Applies when a width = first You may be one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT. EMPTY value indicates that the style is changed.
width - width of the line. valid values - 1,2,3,4,5. EMPTY value indicates that the width is not changed.
CLR - line color.
Sample
SetIndexStyle (3, DRAW_LINE, blank, 2, red);
No comments:
Post a Comment