LastManStandingIndicator
Forums › ProRealTime forum Italiano › Supporto ProBuilder › LastManStandingIndicator
- This topic has 9 replies, 3 voices, and was last updated 7 years ago by elanoa.
-
-
11/02/2017 at 4:15 PM #51336
Salvo Nicolas, spero di aver seguito correttamente le istruzioni.
L’indicatore di cui sopra individua dei punti swing sui vari grafici e disegna anche una media mobile. Spero di essere stato esauriente. Grazie, Salvo
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144//+------------------------------------------------------------------+//| LastManStandingIndicator.mq4 |//| Copyright 2016, Jay Davis |//| https://www.tidyneat.com |//+------------------------------------------------------------------+#property copyright "Copyright 2016, Jay Davis"#property link "https://www.tidyneat.com"#property version "1.1"#property strict#property indicator_chart_window#property indicator_buffers 5extern color MajorSwingColor=clrPurple;extern int MajorSwingSize=3;extern int PeriodsInMajorSwing=13;extern color MinorSwingColor=clrCornflowerBlue;extern int MinorSwingSize=1;extern int PeriodsInMinorSwing=5;extern ENUM_MA_METHOD MovingAveragMethod=MODE_EMA;extern int MovingAveragePeriods= 55;extern color MovingAvergeColor = clrDarkGoldenrod;extern color fiftyPercentLineColor=clrAliceBlue;int lookBack=PeriodsInMajorSwing*2;double majorSwingHigh[];double minorSwingHigh[];double majorSwingLow[];double minorSwingLow[];double EMA[];//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+int OnInit(){//--- indicator buffers mappingSetIndexBuffer(0,majorSwingHigh); //associates array with bufferSetIndexStyle(0,DRAW_ARROW,EMPTY,MajorSwingSize,MajorSwingColor);SetIndexArrow(0,108); // drawing wingding 108SetIndexLabel(0,"Major Swing High");SetIndexBuffer(1,minorSwingHigh); //associates array with bufferSetIndexStyle(1,DRAW_ARROW,EMPTY,MinorSwingSize,MinorSwingColor);SetIndexArrow(1,108); // drawing wingding 108SetIndexLabel(1,"Minor Swing High");SetIndexBuffer(2,majorSwingLow); //associates array with bufferSetIndexStyle(2,DRAW_ARROW,EMPTY,MajorSwingSize,MajorSwingColor);SetIndexArrow(2,108); // drawing wingding 108SetIndexLabel(2,"Major Swing Low");SetIndexBuffer(3,minorSwingLow); //associates array with bufferSetIndexStyle(3,DRAW_ARROW,EMPTY,MinorSwingSize,MinorSwingColor);SetIndexArrow(3,108); // drawing wingding 108SetIndexLabel(3,"Minor Swing Low");SetIndexBuffer(4,EMA); //associates array with bufferSetIndexStyle(4,DRAW_LINE,STYLE_SOLID,EMPTY,MovingAvergeColor);SetIndexLabel(4,"Moving Average");//---return(INIT_SUCCEEDED);}//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+int OnCalculate(const int rates_total,const int prev_calculated,const datetime &time[],const double &open[],const double &high[],const double &low[],const double &close[],const long &tick_volume[],const long &volume[],const int &spread[]){int limit;int counted_bars=IndicatorCounted();//---- check for possible errorsif(counted_bars<0) return(-1);//---- the last counted bar will be recounted//if(counted_bars>0) counted_bars--;limit=Bars-counted_bars;//---- main loop// First Run Through Ruleif(counted_bars==0){if(lookBack>=MovingAveragePeriods){limit-=lookBack;}else{limit-=MovingAveragePeriods;}}//---for(int i=1; i<limit; i++){// Draw Moving AverageEMA[i]=iMA(NULL,0,MovingAveragePeriods,0,MovingAveragMethod,PRICE_CLOSE,i);// Minor Swing High Logicif(iHighest(NULL,0,MODE_HIGH,PeriodsInMinorSwing*2,i)==i+PeriodsInMinorSwing){minorSwingHigh[i+PeriodsInMinorSwing]=High[i+PeriodsInMinorSwing];}// Major Swing High Logicif(iHighest(NULL,0,MODE_HIGH,PeriodsInMajorSwing*2,i)==i+PeriodsInMajorSwing){majorSwingHigh[i+PeriodsInMajorSwing]=High[i+PeriodsInMajorSwing];}// Minor Swing Low Logicif(iLowest(NULL,0,MODE_LOW,PeriodsInMinorSwing*2,i)==i+PeriodsInMinorSwing){minorSwingLow[i+PeriodsInMinorSwing]=Low[i+PeriodsInMinorSwing];}// Major Swing Low Logicif(iLowest(NULL,0,MODE_LOW,PeriodsInMajorSwing*2,i)==i+PeriodsInMajorSwing){majorSwingLow[i+PeriodsInMajorSwing]=Low[i+PeriodsInMajorSwing];}}//--- return value of prev_calculated for next callreturn(rates_total);}//+------------------------------------------------------------------+11/02/2017 at 4:20 PM #5133711/02/2017 at 5:14 PM #5134211/02/2017 at 5:26 PM #5134811/02/2017 at 7:51 PM #5135511/03/2017 at 11:51 AM #5138911/03/2017 at 12:32 PM #51393Ciao Nicolas, non è assolutamente un problema. Non ho alcuna fretta, puoi prendere tutto il tempo che occorre, sempre che sia possibile la traduzione del codice su PRT. Grazie tante e scusami ancora se non sono riuscito a caricare il codice .mq4 come indicato, evidente che sono una frana. Ciao Salvo
11/14/2017 at 9:34 AM #52668Non era così facile e nonostante alcune piccole differenze con il codice originale, ho deciso di rilasciarlo. Lo troverai per scaricare nella nostra libreria:
11/14/2017 at 12:51 PM #5270811/14/2017 at 8:18 PM #52770Ho provato questo indicatore in piattaforma…davvero interessante e molto simile ad un’indicatore di Metatrader4 di cui non dispongo purtroppo il codice ( si chiama trading-signals). Volevo chiedere al sig. Nicolas se era possibile ottimizzarlo…senza la visualizzazione della media EMA e se era possibile inoltre solo la visualizzazione delle indicazioni cerchi viola ( magari sostituendo i cerchi con delle frezzie). Grazie.
-
AuthorPosts