1 //Ïðèìåð îáðàùåíèÿ ê èíäèêàòîðó â ýêñïåðòå(ýêñïåðòíûå âàðèàíòû JJMASeries è JurXSeries):
\r
3 int bar=0;// áàð äîëæåí áûòü òîëüêî íóëåâûì
\r
4 //----+ Ïîëó÷åíèå è ñîõðàíåíèå â áóôôåð çíà÷åíèé èíäèêàòîðà
\r
5 //----+ Áóôôåð Buffer ñëåäóåò ïðîïèñàòü â èíäèêàòîðíûå áóôôåðû
\r
6 Buffer[bar]=iCustom( NULL, 0, "JFatl",Length,Phase,0,Input_Price_Customs,0,bar);
\r
7 //----+ ïðîâåðêà êîëè÷åñòâà áàðîâ íà äîñòàòî÷íîñòü äëÿ äàëüíåéøåãî ðàñ÷¸òà
\r
8 if (Bars-1<39+30+3)return(0);
\r
10 double Trend1=Buffer[1]-Buffer[2];
\r
11 double Trend2=Buffer[2]-Buffer[3];
\r
12 //----+ ïåðåìåííóþ OldTime ñëåäóåò ââåñòè äî ôóíêöèé int start() è int init()
\r
13 if((NewTime!=OldTime)&&(Trend2<0)&&(Trend1>0))Îòêðûâàåòñÿ ïîçèöèÿ íà ïîêóïêó
\r
14 if((NewTime!=OldTime)&&(Trend2>0)&&(Trend1<0))Îòêðûâàåòñÿ ïîçèöèÿ íà ïðîäàæó
\r
18 //Ïðèìåð îáðàùåíèÿ ê JJMASeries (ýêñïåðòíûé âàðèàíò JJMASeries) â ýêñïåðòå:
\r
21 //----+ Îáðàùåíèå ñëåäóåò äåëàòü òîëüêî ÷åðåç öèêë, ãäå ïåðåìåííàÿ bar ïðèíèìàåò çíà÷åíèÿ 0 è 1
\r
22 int reset,limit=1;// ïåðåìåííóþ reset â îáðàùåíèè ê JJMASeries íåëüçÿ çàìåíÿòü ÷èñëîì
\r
23 double Series,Resalt;
\r
24 for(int bar=limit;bar>=0;bar--)
\r
26 Series=PriceSeries(Input_Price_Customs, bar);// åñëè ïðîùå Series=Close[bar];
\r
27 //----+ Îáðàùåíèå ê ôóíêöèè JJMASeries çà íîìåðîì 0 (nJMAdin=0)
\r
28 Resalt=JJMASeries(0,0,MaxBar,limit,Phase,Smooth,Series,bar,reset);
\r
29 //----+ ïðîâåðêà íà îòñóòñòâèå îøèáêè â ïðåäûäóùåé îïåðàöèè (Ýòó ïðîâåðêó â ýêñïåðòå ìîæíî è íå äåëàòü!)
\r
30 if(reset!=0)return(-1);
\r
33 //----+ ïðîâåðêà êîëè÷åñòâà áàðîâ íà äîñòàòî÷íîñòü äëÿ äàëüíåéøåãî ðàñ÷¸òà
\r
34 if (Bars-1<30+3)return(0);
\r
36 int NewTime=Time[1];
\r
37 double Trend1=Buffer[1]-Buffer[2];
\r
38 double Trend2=Buffer[2]-Buffer[3];
\r
39 //----+ ïåðåìåííóþ OldTime ñëåäóåò ââåñòè äî ôóíêöèé int start() è int init()
\r
40 if((NewTime!=OldTime)&&(Trend2<0)&&(Trend1>0))Îòêðûâàåòñÿ ïîçèöèÿ íà ïîêóïêó
\r
41 if((NewTime!=OldTime)&&(Trend2>0)&&(Trend1<0))Îòêðûâàåòñÿ ïîçèöèÿ íà ïðîäàæó
\r