|
这个系统是某个群里的一个前辈分享,个人在使用这个系统进行复盘统计后感觉这个系统还是不错的,现分享给大家。大家看着给点分哈{:soso_e102:} 效果图如下
PS:由于这个系统用的周期很小,个人把这个系统的使用周期扩大到日图以符合个人习惯,发现效果也不错,大家可以根据自己的习惯进行更改。另外renko技术个人感觉很实用,有兴趣的话可以在这个国外论坛里去找找相关的说明。网页在附件里。
asi代码:
- //+------------------------------------------------------------------+
- //| ASI.mq4 |
- //| Copyright ?2007, MetaQuotes Software Corp. |
- //+------------------------------------------------------------------+
- #property copyright "Copyright ?2007, MetaQuotes Software Corp."
- //----
- #property indicator_separate_window
- #property indicator_buffers 1
- #property indicator_color1 DarkBlue
- //---- input parameters
- extern double T = 300.0;
- //---- buffers
- double ExtMapBuffer1[];
- double SIBuffer[];
- //+------------------------------------------------------------------+
- //| Custom indicator initialization function |
- //+------------------------------------------------------------------+
- int init()
- {
- //---- indicators
- IndicatorBuffers(2);
- SetIndexStyle(0, DRAW_LINE);
- SetIndexBuffer(0, ExtMapBuffer1);
- SetIndexLabel(0, "Accumulation Swing Index");
- SetIndexBuffer(1, SIBuffer);
- SetIndexEmptyValue(0, 0.0);
- SetIndexEmptyValue(1, 0.0);
- //----
- return(0);
- }
- //+------------------------------------------------------------------+
- //| Custom indicator deinitialization function |
- //+------------------------------------------------------------------+
- int deinit()
- {
- //----
- return(0);
- }
- //+------------------------------------------------------------------+
- //| Custom indicator iteration function |
- //+------------------------------------------------------------------+
- int start()
- {
- int counted_bars = IndicatorCounted();
- //----
- int i, limit;
- double R, K, TR, ER, SH, Tpoints;
- if(counted_bars == 0)
- limit = Bars - 1;
- if(counted_bars > 0)
- limit = Bars - counted_bars;
- Tpoints = T*MarketInfo(Symbol(), MODE_POINT);
- for(i = limit; i >= 0; i--)
- {
- TR = iATR(Symbol(), 0, 1, i);
- if(Close[i+1] >= Low[i] && Close[i+1] <= High[i])
- ER = 0;
- else
- {
- if(Close[i+1] > High[i])
- ER = MathAbs(High[i] - Close[i+1]);
- if(Close[i+1] < Low[i])
- ER = MathAbs(Low[i] - Close[i+1]);
- }
- K = MathMax(MathAbs(High[i] - Close[i+1]), MathAbs(Low[i] - Close[i+1]));
- SH = MathAbs(Close[i+1] - Open[i+1]);
- R = TR - 0.5*ER + 0.25*SH;
- if(R == 0)
- SIBuffer[i] = 0;
- else
- SIBuffer[i] = 50*(Close[i] - Close[i+1] + 0.5*(Close[i] - Open[i]) +
- 0.25*(Close[i+1] - Open[i+1]))*(K / Tpoints) / R;
- ExtMapBuffer1[i] = ExtMapBuffer1[i+1] + SIBuffer[i];
- }
- //----
- return(0);
- }
- //+------------------------------------------------------------------+
复制代码
nonlagMA代码:
- //+------------------------------------------------------------------+
- //| NonLagMA_v7.mq4 |
- //| Copyright ?2006, TrendLaboratory |
- //+------------------------------------------------------------------+
- #property copyright "Copyright ?2006, TrendLaboratory"
- #property indicator_chart_window
- #property indicator_buffers 3
- #property indicator_color1 Yellow
- #property indicator_width1 2
- #property indicator_color2 Lime
- #property indicator_width2 2
- #property indicator_color3 Red
- #property indicator_width3 2
- //---- input parameters
- extern int Price = 0; //Apply to Price(0-Close;1-Open;2-High;3-Low;4-Median price;5-Typical price;6-Weighted Close)
- extern int Length = 10; //Period of NonLagMA
- extern int Displace = 0; //DispLace or Shift
- extern double PctFilter = 0; //Dynamic filter in decimal
- extern int Color = 1; //Switch of Color mode (1-color)
- extern int ColorBarBack = 1; //Bar back for color mode
- extern double Deviation = 0; //Up/down deviation
- extern int SoundAlertMode = 0; //Sound Alert switch
- //---- indicator buffers
- double MABuffer[];
- double UpBuffer[];
- double DnBuffer[];
- double trend[];
- double Del[];
- double AvgDel[];
- double alfa[];
- int i, Phase, Len, Cycle=4;
- double Coeff, beta, t, Sum, Weight, g;
- double pi = 3.1415926535;
- bool UpTrendAlert=false, DownTrendAlert=false;
- //+------------------------------------------------------------------+
- //| Custom indicator initialization function |
- //+------------------------------------------------------------------+
- int init()
- {
- IndicatorBuffers(6);
- SetIndexStyle(0,DRAW_LINE);
- SetIndexBuffer(0,MABuffer);
- SetIndexStyle(1,DRAW_LINE);
- SetIndexBuffer(1,UpBuffer);
- SetIndexStyle(2,DRAW_LINE);
- SetIndexBuffer(2,DnBuffer);
- SetIndexBuffer(3,trend);
- SetIndexBuffer(4,Del);
- SetIndexBuffer(5,AvgDel);
- string short_name;
- //---- indicator line
-
- IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
- //---- name for DataWindow and indicator subwindow label
- short_name="NonLagMA("+Length+")";
- IndicatorShortName(short_name);
- SetIndexLabel(0,"NonLagMA");
- SetIndexLabel(1,"Up");
- SetIndexLabel(2,"Dn");
- //----
- SetIndexShift(0,Displace);
- SetIndexShift(1,Displace);
- SetIndexShift(2,Displace);
-
- SetIndexEmptyValue(0,EMPTY_VALUE);
- SetIndexEmptyValue(1,EMPTY_VALUE);
- SetIndexEmptyValue(2,EMPTY_VALUE);
-
- SetIndexDrawBegin(0,Length*Cycle+Length+1);
- SetIndexDrawBegin(1,Length*Cycle+Length+1);
- SetIndexDrawBegin(2,Length*Cycle+Length+1);
- //----
-
- Coeff = 3*pi;
- Phase = Length-1;
- Len = Length*Cycle + Phase;
- ArrayResize(alfa,Len);
- Weight=0;
-
- for (i=0;i<Len-1;i++)
- {
- if (i<=Phase-1) t = 1.0*i/(Phase-1);
- else t = 1.0 + (i-Phase+1)*(2.0*Cycle-1.0)/(Cycle*Length-1.0);
- beta = MathCos(pi*t);
- g = 1.0/(Coeff*t+1);
- if (t <= 0.5 ) g = 1;
- alfa[i] = g * beta;
- Weight += alfa[i];
- }
-
- return(0);
- }
- //+------------------------------------------------------------------+
- //| NonLagMA_v7 |
- //+------------------------------------------------------------------+
- int start()
- {
- int i,shift, counted_bars=IndicatorCounted(),limit;
- double price;
- if ( counted_bars > 0 ) limit=Bars-counted_bars;
- if ( counted_bars < 0 ) return(0);
- if ( counted_bars ==0 ) limit=Bars-Len-1;
- if ( counted_bars < 1 )
-
- for(i=1;i<Length*Cycle+Length;i++)
- {
- MABuffer[Bars-i]=0;
- UpBuffer[Bars-i]=0;
- DnBuffer[Bars-i]=0;
- }
-
- for(shift=limit;shift>=0;shift--)
- {
- Sum = 0;
- for (i=0;i<=Len-1;i++)
- {
- price = iMA(NULL,0,1,0,3,Price,i+shift);
- Sum += alfa[i]*price;
-
- }
-
- if (Weight > 0) MABuffer[shift] = (1.0+Deviation/100)*Sum/Weight;
-
-
- if (PctFilter>0)
- {
- Del[shift] = MathAbs(MABuffer[shift] - MABuffer[shift+1]);
-
- double sumdel=0;
- for (i=0;i<=Length-1;i++) sumdel = sumdel+Del[shift+i];
- AvgDel[shift] = sumdel/Length;
-
- double sumpow = 0;
- for (i=0;i<=Length-1;i++) sumpow+=MathPow(Del[shift+i]-AvgDel[shift+i],2);
- double StdDev = MathSqrt(sumpow/Length);
-
- double Filter = PctFilter * StdDev;
-
- if( MathAbs(MABuffer[shift]-MABuffer[shift+1]) < Filter ) MABuffer[shift]=MABuffer[shift+1];
- }
-
- if (Color>0)
- {
- trend[shift]=trend[shift+1];
- if (MABuffer[shift]-MABuffer[shift+1] > Filter) trend[shift]= 1;
- if (MABuffer[shift+1]-MABuffer[shift] > Filter) trend[shift]=-1;
- if (trend[shift]>0)
- {
- UpBuffer[shift] = MABuffer[shift];
- if (trend[shift+ColorBarBack]<0) UpBuffer[shift+ColorBarBack]=MABuffer[shift+ColorBarBack];
- DnBuffer[shift] = EMPTY_VALUE;
- }
- if (trend[shift]<0)
- {
- DnBuffer[shift] = MABuffer[shift];
- if (trend[shift+ColorBarBack]>0) DnBuffer[shift+ColorBarBack]=MABuffer[shift+ColorBarBack];
- UpBuffer[shift] = EMPTY_VALUE;
- }
- }
- }
- //----------
- string Message;
-
- if ( trend[2]<0 && trend[1]>0 && Volume[0]>1 && !UpTrendAlert)
- {
- Message = " "+Symbol()+" M"+Period()+": Signal for BUY";
- if ( SoundAlertMode>0 ) Alert (Message);
- UpTrendAlert=true; DownTrendAlert=false;
- }
-
- if ( trend[2]>0 && trend[1]<0 && Volume[0]>1 && !DownTrendAlert)
- {
- Message = " "+Symbol()+" M"+Period()+": Signal for SELL";
- if ( SoundAlertMode>0 ) Alert (Message);
- DownTrendAlert=true; UpTrendAlert=false;
- }
- //----
- return(0);
- }
复制代码
renkolivechart 代码:
- //+------------------------------------------------------------------+
- //| RenkoLiveChart_v2.0.mq4 |
- //| Inspired from Renco script by "e4" (renko_live_scr.mq4) |
- //| Copyleft 2009 LastViking |
- //+------------------------------------------------------------------+
- #property copyright ""
- #property indicator_chart_window
- #property indicator_buffers 1
- //+------------------------------------------------------------------+
- #include <WinUser32.mqh>
- //+------------------------------------------------------------------+
- extern int BoxSize = 5;
- extern int BoxOffset = 0;
- extern int RenkoTimeFrame = 2; // What time frame to use for the offline renko chart
- extern bool StrangeSymbolName = false;
- //+------------------------------------------------------------------+
- int HstHandle = -1;
- string SymbolName;
- //+------------------------------------------------------------------+
- void UpdateChartWindow() {
- static int hwnd = 0;
-
- if(hwnd == 0) {
- hwnd = WindowHandle(SymbolName, RenkoTimeFrame);
- if(hwnd != 0) Print("Chart window detected");
- }
- if(hwnd != 0) if(PostMessageA(hwnd, WM_COMMAND, 0x822c, 0) == 0) hwnd = 0;
- //if(hwnd != 0) UpdateWindow(hwnd);
- }
- //+------------------------------------------------------------------+
- int start() {
- static int LastFPos = 0;
- static double BoxPoints, PrevLow, PrevHigh, PrevOpen, PrevClose, CurVolume, CurHigh, CurLow;
- static datetime PrevTime;
-
- if(HstHandle < 0) {
- // Init
-
- // Error checking
- if(!IsConnected()) {
- Print("Waiting for connection...");
- return(0);
- }
- if(!IsDllsAllowed()) {
- Print("Error: Dll calls must be allowed!");
- return(-1);
- }
- if(MathAbs(BoxOffset) >= BoxSize) {
- Print("Error: |BoxOffset| should be less then BoxSize!");
- return(-1);
- }
- switch(RenkoTimeFrame) {
- case 1: case 5: case 15: case 30: case 60: case 240:
- case 1440: case 10080: case 43200: case 0:
- Print("Error: Invald time frame used for offline renko chart (RenkoTimeFrame)!");
- return(-1);
- }
- //
-
- if(StrangeSymbolName) SymbolName = StringSubstr(Symbol(), 0, 6);
- else SymbolName = Symbol();
- BoxPoints = NormalizeDouble(BoxSize*Point, Digits);
- PrevLow = NormalizeDouble(BoxOffset*Point + MathFloor(Close[Bars-1]/BoxPoints)*BoxPoints, Digits);
- PrevHigh = PrevLow + BoxPoints;
- PrevOpen = PrevLow;
- PrevClose = PrevHigh;
- CurVolume = 1;
- PrevTime = Time[Bars-1];
-
- // create / open hst file
- HstHandle = FileOpenHistory(SymbolName + RenkoTimeFrame + ".hst", FILE_BIN|FILE_WRITE);
- if(HstHandle < 0) return(-1);
- //
-
- // write hst file header
- int HstUnused[13];
- FileWriteInteger(HstHandle, 400, LONG_VALUE); // Version
- FileWriteString(HstHandle, "", 64); // Copyright
- FileWriteString(HstHandle, SymbolName, 12); // Symbol
- FileWriteInteger(HstHandle, RenkoTimeFrame, LONG_VALUE); // Period
- FileWriteInteger(HstHandle, Digits, LONG_VALUE); // Digits
- FileWriteInteger(HstHandle, 0, LONG_VALUE); // Time Sign
- FileWriteInteger(HstHandle, 0, LONG_VALUE); // Last Sync
- FileWriteArray(HstHandle, HstUnused, 0, 13); // Unused
- //
-
- // process historical data
- int i = Bars-2;
- while(i >= 0) {
-
- CurVolume = CurVolume + Volume[i];
-
- if(LastFPos != 0) {
- FileSeek(HstHandle, LastFPos, SEEK_SET);
- FileWriteDouble(HstHandle, CurVolume, DOUBLE_VALUE);
- }
-
- bool UpTrend = High[i]+Low[i] > PrevHigh+PrevLow;
- // update low before high or the revers depending on is closest to prev. renko bar
-
- while(UpTrend && Low[i] <= PrevLow-BoxPoints) {
- PrevHigh = PrevHigh - BoxPoints;
- PrevLow = PrevLow - BoxPoints;
- PrevOpen = PrevHigh;
- PrevClose = PrevLow;
- CurVolume = 1;
-
- FileWriteInteger(HstHandle, PrevTime, LONG_VALUE);
- FileWriteDouble(HstHandle, PrevOpen, DOUBLE_VALUE);
- FileWriteDouble(HstHandle, PrevLow, DOUBLE_VALUE);
- FileWriteDouble(HstHandle, PrevHigh, DOUBLE_VALUE);
- FileWriteDouble(HstHandle, PrevClose, DOUBLE_VALUE);
- LastFPos = FileTell(HstHandle); // Remeber Last pos in file
- FileWriteDouble(HstHandle, CurVolume, DOUBLE_VALUE);
-
- if(PrevTime < Time[i]) PrevTime = Time[i];
- else PrevTime++;
- }
-
- while(High[i] >= PrevHigh+BoxPoints) {
- PrevHigh = PrevHigh + BoxPoints;
- PrevLow = PrevLow + BoxPoints;
- PrevOpen = PrevLow;
- PrevClose = PrevHigh;
- CurVolume = 1;
-
- FileWriteInteger(HstHandle, PrevTime, LONG_VALUE);
- FileWriteDouble(HstHandle, PrevOpen, DOUBLE_VALUE);
- FileWriteDouble(HstHandle, PrevLow, DOUBLE_VALUE);
- FileWriteDouble(HstHandle, PrevHigh, DOUBLE_VALUE);
- FileWriteDouble(HstHandle, PrevClose, DOUBLE_VALUE);
- LastFPos = FileTell(HstHandle); // Remeber Last pos in file
- FileWriteDouble(HstHandle, CurVolume, DOUBLE_VALUE);
-
- if(PrevTime < Time[i]) PrevTime = Time[i];
- else PrevTime++;
- }
-
- while(!UpTrend && Low[i] <= PrevLow-BoxPoints) {
- PrevHigh = PrevHigh - BoxPoints;
- PrevLow = PrevLow - BoxPoints;
- PrevOpen = PrevHigh;
- PrevClose = PrevLow;
- CurVolume = 1;
-
- FileWriteInteger(HstHandle, PrevTime, LONG_VALUE);
- FileWriteDouble(HstHandle, PrevOpen, DOUBLE_VALUE);
- FileWriteDouble(HstHandle, PrevLow, DOUBLE_VALUE);
- FileWriteDouble(HstHandle, PrevHigh, DOUBLE_VALUE);
- FileWriteDouble(HstHandle, PrevClose, DOUBLE_VALUE);
- LastFPos = FileTell(HstHandle); // Remeber Last pos in file
- FileWriteDouble(HstHandle, CurVolume, DOUBLE_VALUE);
-
- if(PrevTime < Time[i]) PrevTime = Time[i];
- else PrevTime++;
- }
- i--;
- }
- FileFlush(HstHandle);
- //
-
- Comment("RenkoLiveChart(" + BoxSize + "): Open Offline ", SymbolName, ",M", RenkoTimeFrame, " to view chart");
-
- if(PrevClose == PrevHigh) {
- CurHigh = PrevHigh;
- CurLow = PrevHigh;
- } else { // PrevClose == PrevLow
- CurHigh = PrevLow;
- CurLow = PrevLow;
- }
- CurVolume = 0;
-
- UpdateChartWindow();
-
- return(0);
- // End historical data / Init
- }
-
- // Begin live data feed
- if(Bid >= PrevHigh+BoxPoints) {
-
- CurVolume++;
- FileSeek(HstHandle, LastFPos, SEEK_SET);
- FileWriteDouble(HstHandle, CurVolume, DOUBLE_VALUE);
-
- PrevHigh = PrevHigh + BoxPoints;
- PrevLow = PrevLow + BoxPoints;
- PrevOpen = PrevLow;
- PrevClose = PrevHigh;
-
- FileWriteInteger(HstHandle, PrevTime, LONG_VALUE);
- FileWriteDouble(HstHandle, PrevOpen, DOUBLE_VALUE);
- FileWriteDouble(HstHandle, PrevLow, DOUBLE_VALUE);
- FileWriteDouble(HstHandle, PrevHigh, DOUBLE_VALUE);
- FileWriteDouble(HstHandle, PrevClose, DOUBLE_VALUE);
- LastFPos = FileTell(HstHandle); // Remeber Last pos in file
- FileWriteDouble(HstHandle, 1, DOUBLE_VALUE);
- FileFlush(HstHandle);
-
- if(PrevTime < TimeCurrent()) PrevTime = TimeCurrent();
- else PrevTime++;
-
- CurVolume = 0;
- CurHigh = PrevHigh;
- CurLow = PrevHigh;
-
- UpdateChartWindow();
- }
- else if(Bid <= PrevLow-BoxPoints) {
-
- CurVolume++;
- FileSeek(HstHandle, LastFPos, SEEK_SET);
- FileWriteDouble(HstHandle, CurVolume, DOUBLE_VALUE);
-
- PrevHigh = PrevHigh - BoxPoints;
- PrevLow = PrevLow - BoxPoints;
- PrevOpen = PrevHigh;
- PrevClose = PrevLow;
-
- FileWriteInteger(HstHandle, PrevTime, LONG_VALUE);
- FileWriteDouble(HstHandle, PrevOpen, DOUBLE_VALUE);
- FileWriteDouble(HstHandle, PrevLow, DOUBLE_VALUE);
- FileWriteDouble(HstHandle, PrevHigh, DOUBLE_VALUE);
- FileWriteDouble(HstHandle, PrevClose, DOUBLE_VALUE);
- LastFPos = FileTell(HstHandle); // Remeber Last pos in file
- FileWriteDouble(HstHandle, 1, DOUBLE_VALUE);
- FileFlush(HstHandle);
-
- if(PrevTime < TimeCurrent()) PrevTime = TimeCurrent();
- else PrevTime++;
-
- CurVolume = 0;
- CurHigh = PrevLow;
- CurLow = PrevLow;
-
- UpdateChartWindow();
- }
- else {
-
- CurVolume++;
- FileSeek(HstHandle, LastFPos, SEEK_SET);
- FileWriteDouble(HstHandle, CurVolume, DOUBLE_VALUE);
-
- if(CurHigh < Bid) CurHigh = Bid;
- if(CurLow > Bid) CurLow = Bid;
-
- double CurOpen;
- if(PrevHigh <= Bid) CurOpen = PrevHigh;
- else if(PrevLow >= Bid) CurOpen = PrevLow;
- else CurOpen = Bid;
-
- double CurClose = Bid;
-
- FileWriteInteger(HstHandle, PrevTime, LONG_VALUE); // Time
- FileWriteDouble(HstHandle, CurOpen, DOUBLE_VALUE); // Open
- FileWriteDouble(HstHandle, CurLow, DOUBLE_VALUE); // Low
- FileWriteDouble(HstHandle, CurHigh, DOUBLE_VALUE); // High
- FileWriteDouble(HstHandle, CurClose, DOUBLE_VALUE); // Close
- FileWriteDouble(HstHandle, 1, DOUBLE_VALUE); // Volume
- FileFlush(HstHandle);
-
- UpdateChartWindow();
- }
- return(0);
- }
- //+------------------------------------------------------------------+
- int deinit() {
- if(HstHandle >= 0) {
- FileClose(HstHandle);
- HstHandle = -1;
- }
- Comment("");
- return(0);
- }
- //+------------------------------------------------------------------+
-
复制代码
TRO_Tunnel_dragon 代码:
- //+------------------------------------------------------------------+
- //| TRO_Tunnel_dragon |
- //| |
- //| Copyright ?2008, Avery T. Horton, Jr. aka TheRumpledOne |
- //| |
- //| PO BOX 43575, TUCSON, AZ 85733 |
- //| |
- //| GIFTS AND DONATIONS ACCEPTED |
- //| |
- //+------------------------------------------------------------------+
- #property copyright "Copyright ?2008, Avery T. Horton, Jr. aka TRO"
- #property indicator_chart_window
- #property indicator_buffers 8
- #property indicator_color1 DodgerBlue
- #property indicator_color2 Red
- #property indicator_color3 DodgerBlue
- /*
- #property indicator_color4 Purple
- #property indicator_color5 Teal
- #property indicator_color6 Orange
- #property indicator_color7 Red
- #property indicator_color8 Magenta
- */
- // indicators parameters
- extern bool Show.PriceBox = true ;
- extern int myThickness = 1 ;
- extern int myStyle = 0 ;
- extern int myPeriod = 0 ;
- extern int myShift = 0 ;
- extern string notetype = "0=SMA,1=EMA,2=SMMA,3=LWMA" ;
- extern string noteprice = "0=CLOSE,1=OPEN,2=HIGH,3=LOW,4=MEDIAN,5=PP,6=WEIGHT" ;
- extern int myMA_Period1 = 50 ;
- extern int MAType1 = 1;
- extern int MAPrice1 = PRICE_HIGH ;
- extern int myMA_Period2 = 50 ;
- extern int MAType2 = 1;
- extern int MAPrice2 = PRICE_CLOSE ;
- extern int myMA_Period3 = 50 ;
- extern int MAType3 = 1;
- extern int MAPrice3 = PRICE_LOW ;
- //extern int myWingDing = 119 ;
- //---- buffers
- double P0Buffer[];
- double P1Buffer[];
- double P2Buffer[];
- double P3Buffer[];
- double P4Buffer[];
- double P5Buffer[];
- double P6Buffer[];
- double P7Buffer[];
- string tP0Buf = "drma_01" ;
- string tP1Buf = "drma_02" ;
- string tP2Buf = "drma_03" ;
- //+------------------------------------------------------------------+
- //| Custom indicator initialization function |
- //+------------------------------------------------------------------+
- int init()
- {
- //---- name for indicator window
- string short_name=" ";
- IndicatorShortName(short_name);
- SetIndexBuffer(0, P0Buffer);
- SetIndexBuffer(1, P1Buffer);
- SetIndexBuffer(2, P2Buffer);
- SetIndexBuffer(3, P3Buffer);
- SetIndexBuffer(4, P4Buffer);
- SetIndexBuffer(5, P5Buffer);
- SetIndexBuffer(6, P6Buffer);
- SetIndexBuffer(7, P7Buffer);
- //----
- SetIndexArrow(0, 119);
- SetIndexArrow(1, 119);
- SetIndexArrow(2, 119);
- SetIndexArrow(3, 119);
- SetIndexArrow(4, 119);
- SetIndexArrow(5, 119);
- SetIndexArrow(6, 119);
- SetIndexArrow(7, 119);
- SetIndexStyle(0, DRAW_LINE, myStyle, myThickness, indicator_color1 );
- SetIndexStyle(1, DRAW_LINE, myStyle, myThickness, indicator_color2 );
- SetIndexStyle(2, DRAW_LINE, myStyle, myThickness, indicator_color3 );
- /*
- SetIndexStyle(3, DRAW_ARROW, myStyle, myThickness, indicator_color4 );
- SetIndexStyle(4, DRAW_ARROW, myStyle, myThickness, indicator_color5 );
- SetIndexStyle(5, DRAW_ARROW, myStyle, myThickness, indicator_color6 );
- SetIndexStyle(6, DRAW_ARROW, myStyle, myThickness, indicator_color7 );
- SetIndexStyle(7, DRAW_ARROW, myStyle, myThickness, indicator_color8 );
- */
- // setting the indicator values, which will be invisible on the chart
- SetIndexEmptyValue(0,0);
- SetIndexEmptyValue(1,0);
- SetIndexEmptyValue(2,0);
- SetIndexEmptyValue(3,0);
- SetIndexEmptyValue(4,0);
- SetIndexEmptyValue(5,0);
- SetIndexEmptyValue(6,0);
- SetIndexEmptyValue(7,0);
-
- return(0);
- }
- //+------------------------------------------------------------------+
- //| Custom indicator deinitialization function |
- //+------------------------------------------------------------------+
- int deinit()
- {
-
- ObjectDelete(tP0Buf);
- ObjectDelete(tP1Buf);
- ObjectDelete(tP2Buf);
-
- return(0);
- }
- //+------------------------------------------------------------------+
- //| Custom indicator iteration function |
- //+------------------------------------------------------------------+
- int start()
- {
- datetime TimeArray[];
- int i, dayi, 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--;
- int limit = Bars - counted_bars;
- //----
- for(i = limit - 1; i >= 0; i--)
- {
- //---- Tricolor indicator code
- int BarShift = iBarShift(NULL,myPeriod,Time[i+myShift],true);
-
-
- P0Buffer[i] = iMA(NULL,myPeriod,myMA_Period1,0,MAType1,MAPrice1,BarShift);
- P1Buffer[i] = iMA(NULL,myPeriod,myMA_Period2,0,MAType2,MAPrice2,BarShift);
- P2Buffer[i] = iMA(NULL,myPeriod,myMA_Period3,0,MAType3,MAPrice3,BarShift);
-
- }
- if(Show.PriceBox)
- {
- if (ObjectFind(tP0Buf) != 0)
- {
-
- // ObjectCreate(tP0Buf,OBJ_HLINE,0,Time[0],X01);
- ObjectCreate(tP0Buf,OBJ_ARROW,0,Time[0],P0Buffer[0]);
- ObjectSet(tP0Buf,OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
- ObjectSet(tP0Buf,OBJPROP_COLOR,indicator_color1);
- }
- else
- {
- ObjectMove(tP0Buf,0,Time[0],P0Buffer[0]);
- }
-
-
- if (ObjectFind(tP1Buf) != 0)
- {
- ObjectCreate(tP1Buf,OBJ_ARROW,0,Time[0],P1Buffer[0]);
- ObjectSet(tP1Buf,OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
- ObjectSet(tP1Buf,OBJPROP_COLOR,indicator_color2);
- }
- else
- {
- ObjectMove(tP1Buf,0,Time[0],P1Buffer[0]);
- }
- if (ObjectFind(tP2Buf) != 0)
- {
- ObjectCreate(tP2Buf,OBJ_ARROW,0,Time[0],P2Buffer[0]);
- ObjectSet(tP2Buf,OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
- ObjectSet(tP2Buf,OBJPROP_COLOR,indicator_color3);
- }
- else
- {
- ObjectMove(tP2Buf,0,Time[0],P2Buffer[0]);
- }
- }
-
- return(0);
- }
复制代码
|
|