Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools
Zurück   Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools > Metatrader 4 > Programmierung MQL4

Programmierung MQL4 Hier gehts rund ums Programmieren in MQL4.

Login
Benutzername:
Kennwort:


Statistik
Themen: 4798
Beiträge: 42561
Benutzer: 7.159
Aktive Benutzer: 125
Links: 83
Wir begrüßen unseren neuesten Benutzer: Hery Priyanto
Mit 2.475 Benutzern waren die meisten Benutzer gleichzeitig online (16.01.20 um 22:38).
Neue Benutzer:
vor 12 Stunden
- Hery...
vor 4 Tagen
- expertfx
vor einer Woche
- teig
vor einer Woche
- windowsmov...
vor einer Woche
- Grabman.19...

Onlineuser
'Wer ist online' anzeigen Benutzer: 1
Gäste: 33
Gesamt: 34
Team: 0
Team:  
Benutzer:  MA-EA
Freunde anzeigen

Empfehlungen

Antwort
 
Themen-Optionen Thema durchsuchen Ansicht
  #1 (permalink)  
Alt 02.12.21
Mitglied
 
Registriert seit: Feb 2014
Ort: Berlin
Beiträge: 42
Sirocool befindet sich auf einem aufstrebenden Ast
Standard Neues Projekt

Project 1 = STOCHASTIC

LONG und SHORT Signale kommen von der Mainlinie sowie Signallinie es folgt demnächst noch das Trendsignal.

Ihr werdet sehen die dritte wieder gabe ist sehr hilfreich beim Traden.

ich bin für Anregungen und änderungen gerne offen wo man was noch verbessern kann.

FOLGEARBEITEN:

Trendsignal wiedergeben als Punkt
Alert



Code:
//+------------------------------------------------------------------+
//|                SHARK_Stochastic_CLASSIC_V.2.1.0 - 1121           |
//|                         Copyright 2021                           |
//|                      www.companyname.net                         |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                       Farbenauswahl                              |
//|                                                                  |
//| Farbe 01 - C'35,248,48' - Grün                                   |
//| Farbe 02 - C'204,0,15'  - Rot                                    |
//| Farbe 03 - C'93,219,231'- Hellblau                               |
//| Farbe 04 - C'248,86,13' - Orange                                 |
//| Farbe 05 - C'204,0,183' - Magenta                                |
//| Farbe 06 - C'64,121,246'- Dunkelblau                             |
//| Farbe 07 - C'237,252,255'-Weiß                                   |
//| Farbe 07 - C'254,239,79'- Hellgelb                               |
//|                                                                  |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers  5

#property indicator_minimum 0
#property indicator_maximum 100

extern string SETTING = "";

extern int    K_PERIOD =  5;
extern int    D_PERIOD =  3;
extern int     Slowing =  3;

extern int Upper_Limit = 80;
extern int Lower_Limit = 20;

extern ENUM_MA_METHOD  StoSignalMethod = MODE_SMA;

extern ENUM_APPLIED_PRICE APPLEY = PRICE_CLOSE;
extern ENUM_STO_PRICE PRICE_RANGE = 0;

extern string STYL = "";

extern color Upper_Color = C'204,0,15';
extern color Lower_Color = C'35,248,48';
extern color Hlines_Background = C'51,31,52';

extern string ALARM = "";


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
string PriceTypeToString(int pt)
  {
   string answer;
   switch(pt)
     {
      case 0:
         answer = "Close"    ;
         break;
      case 1:
         answer = "Open"     ;
         break;
      case 2:
         answer = "High"     ;
         break;
      case 3:
         answer = "Low"      ;
         break;
      case 4:
         answer = "Median"   ;
         break;
      case 5:
         answer = "Typical"  ;
         break;
      case 6:
         answer = "Wighted"  ;
         break;
      default:
         answer = "Invalid price field requested";
         Alert(answer);
     }
   return(answer);
  }


string Name ="SHARK_STOCHASTIC_CLASSIC_V.2.1.0 - 1121 " + "("+K_PERIOD +","+ D_PERIOD+","+Slowing+","+PriceTypeToString(APPLEY)+","+Upper_Limit+","+Lower_Limit+")";


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int windowIndex=WindowFind(Name);

// ==================================== rectangle names
string NameTopLev=windowIndex+"LevelTop";       //50 -
string NameWaitUp=windowIndex+"LevelWaitTop";   // 55
string NameWaitLo=windowIndex+"LevelWaitBot";   //-45
string NameBotLev=windowIndex+"LevelBot";       //30


//+------------------------------------------------------------------+
//|  Buffer                                                          |
//+------------------------------------------------------------------+
double SHARK_BUFFER_M[],SHARK_BUFFER_S[],SHARK_BUFFER_UP[],SHARK_BUFFER_DN[],SHARK_BUFFER_SIGNAL[];

bool initFinished=false;
datetime time_alert;

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(5);
   IndicatorDigits(Digits);//max. 2

   SetIndexBuffer(0,SHARK_BUFFER_M,INDICATOR_DATA);
   SetIndexStyle(0,DRAW_LINE,EMPTY,1,C'64,121,246');
   SetIndexLabel(0,"MAIN");

   SetIndexBuffer(1,SHARK_BUFFER_S,INDICATOR_DATA);
   SetIndexStyle(1,DRAW_LINE,EMPTY,1,C'204,0,15');
   SetIndexLabel(1,"SIGNAL");

   SetIndexBuffer(2,SHARK_BUFFER_UP,INDICATOR_DATA);
   SetIndexStyle(2,DRAW_ARROW,EMPTY,2,C'0,255,0');
   SetIndexArrow(2,159);
   SetIndexLabel(2,NULL);

   SetIndexBuffer(3,SHARK_BUFFER_DN,INDICATOR_DATA);
   SetIndexStyle(3,DRAW_ARROW,EMPTY,2,C'255,0,0');
   SetIndexArrow(3,159);
   SetIndexLabel(3,NULL);

   SetIndexBuffer(4,SHARK_BUFFER_SIGNAL,INDICATOR_DATA);
   SetIndexStyle(4,DRAW_NONE,EMPTY,1,clrNONE);
   SetIndexLabel(4,"TREND");

   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   ObjectsDeleteAll();
// Löschen wir alle Objekte

   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   _CreateLevelChanel(Upper_Limit,Lower_Limit,Hlines_Background);
   _Upper_Lower_Line(Upper_Limit,Lower_Limit,Upper_Color,Lower_Color);





   int counted_bars=IndicatorCounted(),limit,i;

   if(counted_bars<0)
      return(-1);
   if(counted_bars>0)
      counted_bars--;

   limit=MathMin(Bars-counted_bars,Bars-1);




   for(i = limit; i >= 0 && !IsStopped(); i--)
     {
      SHARK_BUFFER_M[i]= iStochastic(Symbol(),Period(),K_PERIOD,D_PERIOD,Slowing,StoSignalMethod,PRICE_RANGE,MODE_MAIN,i);
      SHARK_BUFFER_S[i]= iStochastic(Symbol(),Period(),K_PERIOD,D_PERIOD,Slowing,StoSignalMethod,PRICE_RANGE,MODE_SIGNAL,i);
      SHARK_BUFFER_SIGNAL[i] = SHARK_BUFFER_M[i] - SHARK_BUFFER_S[i];

      //+------------------------------------------------------------------+
      //| LONG - TRENDSIGNAL                                               |
      //+------------------------------------------------------------------+
      if(((SHARK_BUFFER_S[i] >= 20) && ( SHARK_BUFFER_S[i+1] <= 20 )) || ((SHARK_BUFFER_M[i] >= 20) && ( SHARK_BUFFER_M[i+1] <= 20 ) && (SHARK_BUFFER_M[i] > SHARK_BUFFER_S[i]) &&( SHARK_BUFFER_S[i] < 20 )) )
        {
         SHARK_BUFFER_UP[i+1] = SHARK_BUFFER_M[i+1];  SHARK_BUFFER_UP[i+1] = SHARK_BUFFER_S[i+1];
        }
      //+------------------------------------------------------------------+
      //| SHORT - TRENDSIGNAL                                                   |
      //+------------------------------------------------------------------+
      if(((SHARK_BUFFER_S[i] <= 80) && ( SHARK_BUFFER_S[i+1] >= 80 )) || ((SHARK_BUFFER_M[i] <= 80) && ( SHARK_BUFFER_M[i+1] >= 80 ) && (SHARK_BUFFER_M[i] < SHARK_BUFFER_S[i]) &&( SHARK_BUFFER_S[i] > 80 )))
        {
          SHARK_BUFFER_DN[i+1] = SHARK_BUFFER_M[i+1];SHARK_BUFFER_DN[i+1] = SHARK_BUFFER_S[i+1];
        }







     }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
   return(0);
  }



//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void _CreateLevelChanel(int Upper, int Lower, color BG)
  {
   if(true)
     {
      if(ObjectFind(0,NameTopLev)!=windowIndex)
         if(!ObjectCreate(0,NameTopLev,OBJ_RECTANGLE,windowIndex,
                          Bars-1,80,                     //ChartBegin,70
                          Time[0],100)      //Now,100
           )
            Print(__FUNCTION__+" "+NameTopLev+" failed, Code="+IntegerToString(_LastError));
      ObjectSetInteger(0,NameTopLev,OBJPROP_COLOR,C'2,51,4');

      if(ObjectFind(0,NameBotLev)!=windowIndex)
         if(!ObjectCreate(0,NameBotLev,OBJ_RECTANGLE,windowIndex,
                          Bars-1,20,                      //ChartBegin,50
                          Time[0],0)                    //Now,500
           )
            Print(__FUNCTION__+" "+NameBotLev+" failed, Code="+IntegerToString(_LastError));
      ObjectSetInteger(0,NameBotLev,OBJPROP_COLOR,C'51,0,4');
     }

  }

//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void _Upper_Lower_Line(int UPPER_HEIGHT, int LOWER_DEPTH, color HEIGHT_COLOR, color DEPTH_COLOR)
  {

   if(initFinished==false)
     {
      IndicatorShortName(Name);

      windowIndex=WindowFind(Name);

      if(windowIndex<0)
        {
         // wenn die Nummer des Unterfensters -1 gleich ist, so tritt der Fehler auf
         Print("Can\'t find window");
         //return(0);
        }
      //+------------------------------------------------------------------+
      //|  OVERBOUGHT BEREICH 80 %                                         |
      //+------------------------------------------------------------------+

      ObjectCreate("UPPERTEXT",OBJ_LABEL,windowIndex,0,LOWER_DEPTH);
      ObjectSet("UPPERTEXT",OBJPROP_XDISTANCE,5);
      ObjectSet("UPPERTEXT",OBJPROP_YDISTANCE,25);
      ObjectSetText("UPPERTEXT", "OVERBOUGHT",10,"Times New Roman",clrWhiteSmoke);

      // wir zeichnen die Linie im Unterfenster unseres Indikators
      ObjectCreate("Upperline",OBJ_HLINE,windowIndex,0,LOWER_DEPTH);
      ObjectSet("Upperline",OBJPROP_COLOR,HEIGHT_COLOR);
      ObjectSet("Upperline",OBJPROP_WIDTH,1);
      ObjectSet("Upperline",OBJPROP_STYLE,STYLE_DOT);
      WindowRedraw();
      // wir zeichnen das Fenster, damit wir die Linie sehen
      
      //+------------------------------------------------------------------+
      //|  OVERSOLD BEREICH 20 %                                           |
      //+------------------------------------------------------------------+
      ObjectCreate("LOWERTEXT",OBJ_LABEL,windowIndex,0,LOWER_DEPTH);
      ObjectSet("LOWERTEXT",OBJPROP_XDISTANCE,5);
      ObjectSet("LOWERTEXT",OBJPROP_YDISTANCE,175);
      ObjectSetText("LOWERTEXT", "OVERSOLD",10,"Times New Roman",clrWhiteSmoke);
      
      // wir zeichnen die Linie im Unterfenster unseres Indikators
      ObjectCreate("Lowerline",OBJ_HLINE,windowIndex,0,UPPER_HEIGHT);
      ObjectSet("Lowerline",OBJPROP_COLOR,DEPTH_COLOR);
      ObjectSet("Lowerline",OBJPROP_WIDTH,1);
      ObjectSet("Lowerline",OBJPROP_STYLE,STYLE_DOT);
      WindowRedraw();
      // wir zeichnen das Fenster, damit wir die Linie sehen

      initFinished=true;
      // Das Zeichen wurde schon beendet
     }


  }
//+------------------------------------------------------------------+

[IMG]bilderupload.org/bild/118359332-stochastic[/IMG]

Link zum Bild fals nicht angezeigt wird
Mit Zitat antworten
  #2 (permalink)  
Alt 02.12.21
Mitglied
 
Registriert seit: Feb 2014
Ort: Berlin
Beiträge: 42
Sirocool befindet sich auf einem aufstrebenden Ast
Standard Fehler

wie beomme ich das Hin das wenn man nur Ein Fenster hat. Geht das OVERSOLD leider wo anders hin soll aber immer da unten im Rotenbereich bleiben.
und wenn wir gleich dabei sind wie kann ich das anzeigen lassen (Rechts oder links) Rechts wäre besser als links
Mit Zitat antworten
  #3 (permalink)  
Alt 02.12.21
AVT AVT ist offline
Elite Mitglied
 
Registriert seit: Mar 2018
Ort: Hamburg
Beiträge: 542
AVT befindet sich auf einem aufstrebenden Ast
Standard

In Deiner Funktion void _Upper_Lower_Line
zu Begin einfügen:
Code:
   // === get the subwin height in pixels
   int SubWinHeightPix=ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,ChartWindowFind());
   //Print(" Subwin height in pix: ",(int)SubWinHeightPix);
   // === devide the height, so we get the equivalent for 80|20
   int Equiv80=(int)MathRound( 80*SubWinHeightPix/100 );
   int Equiv20=(int)MathRound( 20*SubWinHeightPix/100 );
Damit kriegt Du in etwa das Pixelverhältnis für die Linien.
Dann bei den Labeln ändern:
Code:
      //ObjectSet("UPPERTEXT",OBJPROP_XDISTANCE,5);
      //ObjectSet("UPPERTEXT",OBJPROP_YDISTANCE,25);
      ObjectSetInteger(0,"UPPERTEXT",OBJPROP_CORNER,CORNER_RIGHT_LOWER); //ReferenceWindowEdge
      ObjectSetInteger(0,"UPPERTEXT",OBJPROP_ANCHOR,CORNER_LEFT_UPPER);  //Example
      ObjectSet("UPPERTEXT",OBJPROP_XDISTANCE,90);                       //hardcoded: 90
      ObjectSetInteger(0,"UPPERTEXT",OBJPROP_YDISTANCE,Equiv80);

      //ObjectSet("LOWERTEXT",OBJPROP_XDISTANCE,5);
      //ObjectSet("LOWERTEXT",OBJPROP_YDISTANCE,175);
      ObjectSetInteger(0,"LOWERTEXT",OBJPROP_CORNER,CORNER_RIGHT_LOWER); //ReferenceWindowEdge
      ObjectSetInteger(0,"LOWERTEXT",OBJPROP_ANCHOR,CORNER_LEFT_UPPER);  //Example
      ObjectSetInteger(0,"LOWERTEXT",OBJPROP_YDISTANCE,Equiv20);
      ObjectSet("LOWERTEXT",OBJPROP_XDISTANCE,72);                       //hardcoded: 72
Da Du Font und Fontgröße fest hast, kannst Du die XDISTANCE auch fest lassen.
Ich habe die Zahlen hier mal an Deine Werte angepaßt. Komplizierter wird es, wenn die Fontgröße und evtl. sogar noch der Font selber vom Benutzer festzulegen ist, dann sind einige andere Verhältnisrechnungen fällig.
Kannst Du als Vorlage für Tests nehmen. AVT
Mit Zitat antworten
  #4 (permalink)  
Alt 03.12.21
Mitglied
 
Registriert seit: Feb 2014
Ort: Berlin
Beiträge: 42
Sirocool befindet sich auf einem aufstrebenden Ast
Standard Update V.2.1.0 - 1221

Haut noch nicht ganz Hin aber sieht schonmal besser aus.

Signale = 100 %
Linien 80 / 20 = 100 %
Text = 90 %
Alert = 0 %
Level Channel = 0% wurde erstmal deaktiviert


Code:
//+------------------------------------------------------------------+
//|                SHARK_Stochastic_CLASSIC_V.2.1.0 - 1221           |
//|                         Copyright 2021                           |
//|                      www.companyname.net                         |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                       Farbenauswahl                              |
//|                                                                  |
//| Farbe 01 - C'35,248,48' - Grün                                   |
//| Farbe 02 - C'204,0,15'  - Rot                                    |
//| Farbe 03 - C'93,219,231'- Hellblau                               |
//| Farbe 04 - C'248,86,13' - Orange                                 |
//| Farbe 05 - C'204,0,183' - Magenta                                |
//| Farbe 06 - C'64,121,246'- Dunkelblau                             |
//| Farbe 07 - C'237,252,255'-Weiß                                   |
//| Farbe 07 - C'254,239,79'- Hellgelb                               |
//|                                                                  |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers  5

#property indicator_minimum 0
#property indicator_maximum 100

extern string Inputs = "";

extern int    K_Length =  5;
extern int    K_Smoothing =  3;
extern int    D_Smoothing =  3;



extern ENUM_MA_METHOD  StoSignalMethod = MODE_SMA;

extern ENUM_APPLIED_PRICE APPLEY = PRICE_CLOSE;
extern ENUM_STO_PRICE PRICE_RANGE = 0;

extern string STYL = "";



extern string ALARM = "";


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
string PriceTypeToString(int pt)
  {
   string answer;
   switch(pt)
     {
      case 0:
         answer = "Close"    ;
         break;
      case 1:
         answer = "Open"     ;
         break;
      case 2:
         answer = "High"     ;
         break;
      case 3:
         answer = "Low"      ;
         break;
      case 4:
         answer = "Median"   ;
         break;
      case 5:
         answer = "Typical"  ;
         break;
      case 6:
         answer = "Wighted"  ;
         break;
      default:
         answer = "Invalid price field requested";
         Alert(answer);
     }
   return(answer);
  }


string Name ="SHARK_STOCHASTIC_CLASSIC_V.2.1.0 - 1221 " + "("+K_Length +","+K_Smoothing+","+D_Smoothing+")";


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int windowIndex=WindowFind(Name);

// ==================================== rectangle names
string NameTopLev=windowIndex+"LevelTop";       //50 -
string NameWaitUp=windowIndex+"LevelWaitTop";   // 55
string NameWaitLo=windowIndex+"LevelWaitBot";   //-45
string NameBotLev=windowIndex+"LevelBot";       //30


//+------------------------------------------------------------------+
//|  Buffer                                                          |
//+------------------------------------------------------------------+
double SHARK_BUFFER_M[],SHARK_BUFFER_S[],TREND_BUFFER_UP[],TREND_BUFFER_DN[],SHARK_BUFFER_SIGNAL[];

bool initFinished=false;
datetime time_alert;

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(5);
   IndicatorDigits(Digits);//max. 2

   SetIndexBuffer(0,SHARK_BUFFER_M,INDICATOR_DATA);
   SetIndexStyle(0,DRAW_LINE,EMPTY,1,C'64,121,246');
   SetIndexLabel(0,"MAIN");

   SetIndexBuffer(1,SHARK_BUFFER_S,INDICATOR_DATA);
   SetIndexStyle(1,DRAW_LINE,EMPTY,1,C'204,0,15');
   SetIndexLabel(1,"SIGNAL");

   SetIndexBuffer(2,TREND_BUFFER_UP,INDICATOR_DATA);
   SetIndexStyle(2,DRAW_ARROW,EMPTY,2,C'0,255,0');
   SetIndexArrow(2,119);
   SetIndexLabel(2,NULL);

   SetIndexBuffer(3,TREND_BUFFER_DN,INDICATOR_DATA);
   SetIndexStyle(3,DRAW_ARROW,EMPTY,2,C'255,0,0');
   SetIndexArrow(3,119);
   SetIndexLabel(3,NULL);

   SetIndexBuffer(4,SHARK_BUFFER_SIGNAL,INDICATOR_DATA);
   SetIndexStyle(4,DRAW_NONE,EMPTY,1,clrNONE);
   SetIndexLabel(4,"TREND");



   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   ObjectsDeleteAll();
// Löschen wir alle Objekte

   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
//_CreateLevelChanel();
   _Upper_Lower_Line();






   int counted_bars=IndicatorCounted(),limit,i;

   if(counted_bars<0)
      return(-1);
   if(counted_bars>0)
      counted_bars--;

   limit=MathMin(Bars-counted_bars,Bars-1);




   for(i = limit; i >= 0 && !IsStopped(); i--)
     {
      SHARK_BUFFER_M[i]= iStochastic(Symbol(),Period(),K_Length,D_Smoothing,K_Smoothing,StoSignalMethod,PRICE_RANGE,MODE_MAIN,i);
      SHARK_BUFFER_S[i]= iStochastic(Symbol(),Period(),K_Length,D_Smoothing,K_Smoothing,StoSignalMethod,PRICE_RANGE,MODE_SIGNAL,i);
      SHARK_BUFFER_SIGNAL[i] = SHARK_BUFFER_M[i] - SHARK_BUFFER_S[i];

      //+------------------------------------------------------------------+
      //| TRENDSIGNAL - OVERBOUGHT                                         |
      //+------------------------------------------------------------------+
      if((SHARK_BUFFER_S[i] <= 80) && (SHARK_BUFFER_S[i+1] >= 80) && (SHARK_BUFFER_S[i] > SHARK_BUFFER_M[i]))
        {
         bool TREND_UP = false;
         TREND_BUFFER_DN[i+1] = SHARK_BUFFER_S[i+1];
         bool TREND_DN = true;
        }
      if((SHARK_BUFFER_SIGNAL[i+1] >= 0) && (SHARK_BUFFER_SIGNAL[i] < 0)&& (SHARK_BUFFER_S[i] >= 20) && TREND_DN == true)
        {
         TREND_BUFFER_DN[i+1] = SHARK_BUFFER_S[i+1];
        }

      //+------------------------------------------------------------------+
      //| TRENDSIGNAL - OVERSOLD                                           |
      //+------------------------------------------------------------------+
      if((SHARK_BUFFER_S[i+1] <= 20) && (SHARK_BUFFER_S[i] >= 20) && (SHARK_BUFFER_S[i] < SHARK_BUFFER_M[i]))
        {
         TREND_DN = false;
         TREND_BUFFER_UP[i+1] = SHARK_BUFFER_S[i+1];
         TREND_UP = true;
        }
      if((SHARK_BUFFER_SIGNAL[i+1] <= 0) && (SHARK_BUFFER_SIGNAL[i] > 0)&& (SHARK_BUFFER_S[i] <=80) && TREND_UP == true)
        {
         TREND_BUFFER_UP[i+1] = SHARK_BUFFER_S[i+1];
        }
     }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
   return(0);
  }



//+------------------------------------------------------------------+
//| OVERBOUGHT / OVERSOLD  = 80 / 20 BEREICH                         |
//+------------------------------------------------------------------+
void _CreateLevelChanel()
  {
   if(true)
     {

      if(ObjectFind(0,NameTopLev)!=windowIndex)
         if(!ObjectCreate(0,NameTopLev,OBJ_RECTANGLE,windowIndex,
                          Bars-1,50,                     //ChartBegin,70
                          Time[0],80)      //Now,100
           )
            Print(__FUNCTION__+" "+NameTopLev+" failed, Code="+IntegerToString(_LastError));
      ObjectSetInteger(0,NameTopLev,OBJPROP_COLOR,C'51,51,50');



      if(ObjectFind(0,NameBotLev)!=windowIndex)
         if(!ObjectCreate(0,NameBotLev,OBJ_RECTANGLE,windowIndex,
                          Bars-1,50,                      //ChartBegin,50
                          Time[0],20)                    //Now,500
           )
            Print(__FUNCTION__+" "+NameBotLev+" failed, Code="+IntegerToString(_LastError));
      ObjectSetInteger(0,NameBotLev,OBJPROP_COLOR,C'51,51,50');
     }

  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| OVERBOUGHT / OVERSOLD  = 80 / 20 LINIEN                          |
//+------------------------------------------------------------------+
void _Upper_Lower_Line()
  {

// === get the subwin height in pixels
   int SubWinHeightPix=ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,ChartWindowFind());
//Print(" Subwin height in pix: ",(int)SubWinHeightPix);
// === devide the height, so we get the equivalent for 80|20
   int Equiv80=(int)MathRound(80*SubWinHeightPix/100);
   int Equiv20=(int)MathRound(20*SubWinHeightPix/100);


   if(initFinished==false)
     {
      IndicatorShortName(Name);

      windowIndex=WindowFind(Name);

      if(windowIndex<0)
        {
         // wenn die Nummer des Unterfensters -1 gleich ist, so tritt der Fehler auf
         Print("Can\'t find window");
         //return(0);
        }
      //+------------------------------------------------------------------+
      //| OVERBOUGHT BEREICH 80.0 % LINIE                                 |
      //+------------------------------------------------------------------+
      // wir zeichnen die Linie im Unterfenster unseres Indikators
      ObjectCreate("Upperline",OBJ_HLINE,windowIndex,0,80);
      ObjectSet("Upperline",OBJPROP_COLOR,C'35,248,48');
      ObjectSet("Upperline",OBJPROP_WIDTH,1);
      ObjectSet("Upperline",OBJPROP_STYLE,STYLE_DOT);
      WindowRedraw();
      // wir zeichnen das Fenster, damit wir die Linie sehen

      //+------------------------------------------------------------------+
      //| OVERBOUGHT BEREICH 80.0 % TEXT (AVT by www.expert-advisor.com)   |
      //+------------------------------------------------------------------+
      ObjectCreate("UPPERTEXT",OBJ_LABEL,windowIndex,0,100);
      //ObjectSet("UPPERTEXT",OBJPROP_XDISTANCE,5);
      //ObjectSet("UPPERTEXT",OBJPROP_YDISTANCE,25);
      ObjectSetInteger(0,"UPPERTEXT",OBJPROP_CORNER,CORNER_RIGHT_LOWER); //ReferenceWindowEdge
      ObjectSetInteger(0,"UPPERTEXT",OBJPROP_ANCHOR,CORNER_LEFT_UPPER);  //Example
      ObjectSet("UPPERTEXT",OBJPROP_XDISTANCE,90);                       //hardcoded: 90
      ObjectSetInteger(0,"UPPERTEXT",OBJPROP_YDISTANCE,Equiv80);
      ObjectSetText("UPPERTEXT", "OVERBOUGHT",10,"Times New Roman",clrWhiteSmoke);

      //+------------------------------------------------------------------+
      //|  OVERSOLD BEREICH 20.0 % LINIE                                   |
      //+------------------------------------------------------------------+
      // wir zeichnen die Linie im Unterfenster unseres Indikators
      ObjectCreate("Lowerline",OBJ_HLINE,windowIndex,0,20);
      ObjectSet("Lowerline",OBJPROP_COLOR,C'204,0,15');
      ObjectSet("Lowerline",OBJPROP_WIDTH,1);
      ObjectSet("Lowerline",OBJPROP_STYLE,STYLE_DOT);
      WindowRedraw();
      // wir zeichnen das Fenster, damit wir die Linie sehen

      //+------------------------------------------------------------------+
      //|  OVERSOLD BEREICH 20.0 % TEXT (AVT by www.expert-advisor.com)    |
      //+------------------------------------------------------------------+
      ObjectCreate("LOWERTEXT",OBJ_LABEL,windowIndex,0,0);
      ObjectSetInteger(0,"LOWERTEXT",OBJPROP_CORNER,CORNER_RIGHT_LOWER); //ReferenceWindowEdge
      ObjectSetInteger(0,"LOWERTEXT",OBJPROP_ANCHOR,CORNER_LEFT_UPPER);  //Example
      ObjectSetInteger(0,"LOWERTEXT",OBJPROP_YDISTANCE,Equiv20);
      ObjectSet("LOWERTEXT",OBJPROP_XDISTANCE,72);                       //hardcoded: 72
      ObjectSetText("LOWERTEXT", "OVERSOLD",10,"Times New Roman",clrWhiteSmoke);

      initFinished=true;
      // Das Zeichen wurde schon beendet
     }
  }
//+------------------------------------------------------------------+
Mit Zitat antworten
  #5 (permalink)  
Alt 03.12.21
Mitglied
 
Registriert seit: Feb 2014
Ort: Berlin
Beiträge: 42
Sirocool befindet sich auf einem aufstrebenden Ast
Standard Update V.2.1.0 - 1221

OVERBOUGHT | OVERSOLD = 100 %
LONG | SHORT - SIGNALE = 100 %
80 | 20 Linie = 100%
Levelchanel = deaktiviert vorerst
Alert in arbeit


Code:
//+------------------------------------------------------------------+
//|                SHARK_Stochastic_CLASSIC_V.2.1.0 - 1221           |
//|                         Copyright 2021                           |
//|                      www.companyname.net                         |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                       Farbenauswahl                              |
//|                                                                  |
//| Farbe 01 - C'35,248,48' - Grün                                   |
//| Farbe 02 - C'204,0,15'  - Rot                                    |
//| Farbe 03 - C'93,219,231'- Hellblau                               |
//| Farbe 04 - C'248,86,13' - Orange                                 |
//| Farbe 05 - C'204,0,183' - Magenta                                |
//| Farbe 06 - C'64,121,246'- Dunkelblau                             |
//| Farbe 07 - C'237,252,255'-Weiß                                   |
//| Farbe 07 - C'254,239,79'- Hellgelb                               |
//|                                                                  |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

#property indicator_separate_window
#property indicator_buffers  5

#property indicator_minimum 0
#property indicator_maximum 100

//+------------------------------------------------------------------+
//| EINSTELLUNGEN                                                    |
//+------------------------------------------------------------------+

extern string Inputs = "";

extern int    K_Length =  5;
extern int    K_Smoothing =  3;
extern int    D_Smoothing =  3;

extern ENUM_MA_METHOD  StoSignalMethod = MODE_SMA;
extern ENUM_APPLIED_PRICE APPLEY = PRICE_CLOSE;
extern ENUM_STO_PRICE PRICE_RANGE = 0;

extern string STYL = "";



extern string ALARM = "";

/*
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
string PriceTypeToString(int pt)
  {
   string answer;
   switch(pt)
     {
      case 0:
         answer = "Close"    ;
         break;
      case 1:
         answer = "Open"     ;
         break;
      case 2:
         answer = "High"     ;
         break;
      case 3:
         answer = "Low"      ;
         break;
      case 4:
         answer = "Median"   ;
         break;
      case 5:
         answer = "Typical"  ;
         break;
      case 6:
         answer = "Wighted"  ;
         break;
      default:
         answer = "Invalid price field requested";
         Alert(answer);
     }
   return(answer);
  }
*/

string Name ="SHARK_STOCHASTIC_CLASSIC_V.2.1.0 - 1221 " + "("+K_Length +","+K_Smoothing+","+D_Smoothing+")";


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int windowIndex=WindowFind(Name);

// ==================================== rectangle names
string NameTopLev=windowIndex+"LevelTop";       //50 -
string NameWaitUp=windowIndex+"LevelWaitTop";   // 55
string NameWaitLo=windowIndex+"LevelWaitBot";   //-45
string NameBotLev=windowIndex+"LevelBot";       //30


//+------------------------------------------------------------------+
//|  Buffer                                                          |
//+------------------------------------------------------------------+
double SHARK_BUFFER_M[],SHARK_BUFFER_S[],TREND_BUFFER_UP[],TREND_BUFFER_DN[],SHARK_BUFFER_SIGNAL[];

bool initFinished=false;
datetime time_alert;

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(5);
   IndicatorDigits(Digits);//max. 2

   SetIndexBuffer(0,SHARK_BUFFER_M,INDICATOR_DATA);
   SetIndexStyle(0,DRAW_LINE,EMPTY,1,C'64,121,246');
   SetIndexLabel(0,"MAIN");

   SetIndexBuffer(1,SHARK_BUFFER_S,INDICATOR_DATA);
   SetIndexStyle(1,DRAW_LINE,EMPTY,1,C'204,0,15');
   SetIndexLabel(1,"SIGNAL");

   SetIndexBuffer(2,TREND_BUFFER_UP,INDICATOR_DATA);
   SetIndexStyle(2,DRAW_ARROW,EMPTY,2,C'0,255,0');
   SetIndexArrow(2,119);
   SetIndexLabel(2,NULL);

   SetIndexBuffer(3,TREND_BUFFER_DN,INDICATOR_DATA);
   SetIndexStyle(3,DRAW_ARROW,EMPTY,2,C'255,0,0');
   SetIndexArrow(3,119);
   SetIndexLabel(3,NULL);

   SetIndexBuffer(4,SHARK_BUFFER_SIGNAL,INDICATOR_DATA);
   SetIndexStyle(4,DRAW_NONE,EMPTY,1,clrNONE);
   SetIndexLabel(4,"TREND");



   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   ObjectsDeleteAll();
// Löschen wir alle Objekte

   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
//_CreateLevelChanel();
   _Upper_Lower_Line();






   int counted_bars=IndicatorCounted(),limit,i;

   if(counted_bars<0)
      return(-1);
   if(counted_bars>0)
      counted_bars--;

   limit=MathMin(Bars-counted_bars,Bars-1);




   for(i = limit; i >= 0 && !IsStopped(); i--)
     {
      SHARK_BUFFER_M[i]= iStochastic(Symbol(),Period(),K_Length,D_Smoothing,K_Smoothing,StoSignalMethod,PRICE_RANGE,MODE_MAIN,i);
      SHARK_BUFFER_S[i]= iStochastic(Symbol(),Period(),K_Length,D_Smoothing,K_Smoothing,StoSignalMethod,PRICE_RANGE,MODE_SIGNAL,i);
      SHARK_BUFFER_SIGNAL[i] = SHARK_BUFFER_M[i] - SHARK_BUFFER_S[i];

      //+------------------------------------------------------------------+
      //| TRENDSIGNAL - OVERBOUGHT                                         |
      //+------------------------------------------------------------------+
      if((SHARK_BUFFER_S[i] <= 80) && (SHARK_BUFFER_S[i+1] >= 80) && (SHARK_BUFFER_S[i] > SHARK_BUFFER_M[i]))
        {
         bool TREND_UP = false;
         TREND_BUFFER_DN[i+1] = SHARK_BUFFER_S[i+1];
         bool TREND_DN = true;
        }
      if((SHARK_BUFFER_SIGNAL[i+1] >= 0) && (SHARK_BUFFER_SIGNAL[i] < 0)&& (SHARK_BUFFER_S[i] >= 20) && TREND_DN == true)
        {
         TREND_BUFFER_DN[i+1] = SHARK_BUFFER_S[i+1];
        }

      //+------------------------------------------------------------------+
      //| TRENDSIGNAL - OVERSOLD                                           |
      //+------------------------------------------------------------------+
      if((SHARK_BUFFER_S[i+1] <= 20) && (SHARK_BUFFER_S[i] >= 20) && (SHARK_BUFFER_S[i] < SHARK_BUFFER_M[i]))
        {
         TREND_DN = false;
         TREND_BUFFER_UP[i+1] = SHARK_BUFFER_S[i+1];
         TREND_UP = true;
        }
      if((SHARK_BUFFER_SIGNAL[i+1] <= 0) && (SHARK_BUFFER_SIGNAL[i] > 0)&& (SHARK_BUFFER_S[i] <=80) && TREND_UP == true)
        {
         TREND_BUFFER_UP[i+1] = SHARK_BUFFER_S[i+1];
        }
     }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
   return(0);
  }



//+------------------------------------------------------------------+
//| OVERBOUGHT / OVERSOLD  = 80 / 20 BEREICH                         |
//+------------------------------------------------------------------+
void _CreateLevelChanel()
  {
   if(true)
     {

      if(ObjectFind(0,NameTopLev)!=windowIndex)
         if(!ObjectCreate(0,NameTopLev,OBJ_RECTANGLE,windowIndex,
                          Bars-1,50,                     //ChartBegin,70
                          Time[0],80)      //Now,100
           )
            Print(__FUNCTION__+" "+NameTopLev+" failed, Code="+IntegerToString(_LastError));
      ObjectSetInteger(0,NameTopLev,OBJPROP_COLOR,C'51,51,50');



      if(ObjectFind(0,NameBotLev)!=windowIndex)
         if(!ObjectCreate(0,NameBotLev,OBJ_RECTANGLE,windowIndex,
                          Bars-1,50,                      //ChartBegin,50
                          Time[0],20)                    //Now,500
           )
            Print(__FUNCTION__+" "+NameBotLev+" failed, Code="+IntegerToString(_LastError));
      ObjectSetInteger(0,NameBotLev,OBJPROP_COLOR,C'51,51,50');
     }

  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| OVERBOUGHT / OVERSOLD  = 80 / 20 LINIEN                          |
//+------------------------------------------------------------------+
void _Upper_Lower_Line()
  {

// === get the subwin height in pixels
   int SubWinHeightPix=ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,ChartWindowFind());
//Print(" Subwin height in pix: ",(int)SubWinHeightPix);
// === devide the height, so we get the equivalent for 80|20
   int Equiv80=(int)MathRound(80*SubWinHeightPix/100);
   int Equiv20=(int)MathRound(20*SubWinHeightPix/100);


   if(initFinished==false)
     {
      IndicatorShortName(Name);

      windowIndex=WindowFind(Name);

      if(windowIndex<0)
        {
         // wenn die Nummer des Unterfensters -1 gleich ist, so tritt der Fehler auf
         Print("Can\'t find window");
         //return(0);
        }
      //+------------------------------------------------------------------+
      //| OVERBOUGHT BEREICH 80.0 % LINIE                                 |
      //+------------------------------------------------------------------+
      // wir zeichnen die Linie im Unterfenster unseres Indikators
      ObjectCreate("Upperline",OBJ_HLINE,windowIndex,0,80);
      ObjectSet("Upperline",OBJPROP_COLOR,C'35,248,48');
      ObjectSet("Upperline",OBJPROP_WIDTH,1);
      ObjectSet("Upperline",OBJPROP_STYLE,STYLE_DOT);
      WindowRedraw();
      // wir zeichnen das Fenster, damit wir die Linie sehen

      //+------------------------------------------------------------------+
      //| OVERBOUGHT BEREICH 80.0 % TEXT (AVT by www.expert-advisor.com)   |
      //+------------------------------------------------------------------+
      ObjectCreate("UPPERTEXT",OBJ_TEXT,1,Time[WindowFirstVisibleBar()],90);
      ObjectSetInteger(0,"UPPERTEXT",OBJPROP_CORNER,CORNER_RIGHT_LOWER); //ReferenceWindowEdge
      ObjectSetInteger(0,"UPPERTEXT",OBJPROP_ANCHOR,CORNER_LEFT_UPPER);  //Example
      ObjectSet("UPPERTEXT",OBJPROP_XDISTANCE,90);                       //hardcoded: 90
      ObjectSetInteger(0,"UPPERTEXT",OBJPROP_YDISTANCE,0);
      ObjectSetText("UPPERTEXT", "OVERBOUGHT",10,"Times New Roman",clrWhiteSmoke);

      //+------------------------------------------------------------------+
      //|  OVERSOLD BEREICH 20.0 % LINIE                                   |
      //+------------------------------------------------------------------+
      // wir zeichnen die Linie im Unterfenster unseres Indikators
      ObjectCreate("Lowerline",OBJ_HLINE,windowIndex,0,20);
      ObjectSet("Lowerline",OBJPROP_COLOR,C'204,0,15');
      ObjectSet("Lowerline",OBJPROP_WIDTH,1);
      ObjectSet("Lowerline",OBJPROP_STYLE,STYLE_DOT);
      WindowRedraw();
      // wir zeichnen das Fenster, damit wir die Linie sehen

      //+------------------------------------------------------------------+
      //|  OVERSOLD BEREICH 20.0 % TEXT (AVT by www.expert-advisor.com)    |
      //+------------------------------------------------------------------+
      ObjectCreate("LOWERTEXT",OBJ_TEXT,1,Time[WindowFirstVisibleBar()],30);
      ObjectSetInteger(0,"LOWERTEXT",OBJPROP_CORNER,CORNER_RIGHT_LOWER); //ReferenceWindowEdge
      ObjectSetInteger(0,"LOWERTEXT",OBJPROP_ANCHOR,CORNER_LEFT_UPPER);  //Example
      ObjectSetInteger(0,"LOWERTEXT",OBJPROP_YDISTANCE,90);
      ObjectSet("LOWERTEXT",OBJPROP_XDISTANCE,0);                       //hardcoded: 72
      ObjectSetText("LOWERTEXT", "OVERSOLD",10,"Times New Roman",clrWhiteSmoke);

      initFinished=true;
      // Das Zeichen wurde schon beendet
     }
  }
//+------------------------------------------------------------------+
Mit Zitat antworten
  #6 (permalink)  
Alt 03.12.21
AVT AVT ist offline
Elite Mitglied
 
Registriert seit: Mar 2018
Ort: Hamburg
Beiträge: 542
AVT befindet sich auf einem aufstrebenden Ast
Standard

Code:
int deinit()
  {
   ObjectsDeleteAll();
// Löschen wir alle Objekte

   return(0);
  }
NEIN, das machen wir nicht, es gibt nämlich noch mehr Objekte als nur die des Indikators.
Entschuldige, daß ich da so heftig werde, ich habe mir schon x-mal meine Charts versaut, weil ich einen Indikator auf einen Arbeitschart losgelassen hatte (mache ich auch nie wieder).
Darum bitte nie einfach alle Objekte löschen.
Danke. AVT
Mit Zitat antworten
  #7 (permalink)  
Alt 07.12.21
Mitglied
 
Registriert seit: Feb 2014
Ort: Berlin
Beiträge: 42
Sirocool befindet sich auf einem aufstrebenden Ast
Standard Project MACD

Project 2



Kann mal bitte einer drüber schauen mit den alert wenn man von chart zu chart weckselt leiert der sehr lange oder kommt keine rückmeldung im browser das dauert ca 2 min dann geht wieder.

Code:
//+------------------------------------------------------------------+
//|                 SHARK_MACD_CLASSIC_V.2.1.0 - 1221                |
//|                         Copyright 2020                           |
//|                     www.expert-advisor.com                       |
//+------------------------------------------------------------------+
/*
#property copyright     "©2007-2021 SHARK_MACD_CLASSIC_V.21. Alle Rechte vorbehalten "
//#property strict
#property description   "*~~* SHARK_MACD_CLASSIC_V.21 *~~*"
#property description   "                                 "
#property description   "  The MACD Indicator With Alert  "
#property description   "                                 "
#property description   "WARNING : You use this software at your own risk."
#property description   "The creator of these plugins cannot be held responsible for damage or loss."
#property description   "                                 "

//#property icon          "\\Files\\Shark.ico"

*/

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
#include <stdlib.mqh>
#include <stderror.mqh>
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers  7
#property indicator_level1  0;
#property indicator_levelcolor C'117,134,150'
#property indicator_levelstyle DRAW_ZIGZAG

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

extern string  a_SHARK_SETTINGS ="~~* MACD SETTINGS *~~";

extern int    FAST_LENGTH = 12;
extern int    SLOW_LENGTH = 26;

extern ENUM_APPLIED_PRICE SOURCE = PRICE_CLOSE;

extern int    SIGNAL_SMOOTHING  = 9;

extern  ENUM_MA_METHOD OSCILLATOR_MA_TYPE = 1;
extern  ENUM_MA_METHOD SIGNAL_LINE_MA_TYPE = 1;

extern string  b_SHARK_SETTINGS ="~~* COLOR SETTINGS *~~";

extern color MACD_LINIE   = C'41,98,255';
extern color SIGNAL_LINIE = C'255,109,0';

extern string  c_SHARK_SETTINGS ="~~* COLOR HISTORGRAM *~~";

extern color ABOVE_UP   = C'38,166,154';
extern color ABOVE_DN   = C'178,223,219';

extern color BELOW_DN   = C'255,82,82';
extern color BELOW_UP   = C'255,205,210';

extern string d_SHARK_SETTINGS ="~~* ALERT SETTINGS *~~";

extern bool PopupAlerts   = true;

//Premium noch in Arbeit

//extern ENUM_MACD_ALERT PopupAlerts   = true;


//extern ENUM_MACD_ALERT   PushNotificationAlerts = false;
//extern ENUM_MACD_ALERT   SoundAlerts            = false;
//extern string SoundFileLong          = "alert.wav";
//extern string SoundFileShort         = "alert2.wav";
//extern bool   EmailAlerts            = false;







datetime time_alert; //used when sending alert


double SHARK_BUFFER_M[],SHARK_BUFFER_S[], SHARK_BUFFER_T[],SHARK_BUFFER_DN[],SHARK_BUFFER_DN_UP[],SHARK_BUFFER_UP[],SHARK_BUFFER_UP_DN[];




bool ExtParameters=false;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(7);
   IndicatorDigits(Digits);//max. 2

   SetIndexBuffer(0,SHARK_BUFFER_M,INDICATOR_DATA); // MACD_LINIE
   SetIndexStyle(0,DRAW_LINE,EMPTY,1,MACD_LINIE);
   SetIndexDrawBegin(0,FAST_LENGTH);
   SetIndexLabel(0,"MAIN");

   SetIndexBuffer(1,SHARK_BUFFER_S,INDICATOR_DATA);// SIGNAL_LINIE
   SetIndexStyle(1,DRAW_LINE,EMPTY,1,SIGNAL_LINIE);
   SetIndexDrawBegin(1,SLOW_LENGTH);
   SetIndexLabel(1,"SIGNAL");

   SetIndexBuffer(2,SHARK_BUFFER_T,INDICATOR_DATA);
   SetIndexStyle(2,DRAW_HISTOGRAM,EMPTY_VALUE,3,clrNONE);


   SetIndexBuffer(3,SHARK_BUFFER_UP,INDICATOR_DATA);
   SetIndexStyle(3,DRAW_HISTOGRAM,EMPTY,3,ABOVE_UP);
   SetIndexLabel(3,NULL);

   SetIndexBuffer(4,SHARK_BUFFER_DN,INDICATOR_DATA);
   SetIndexStyle(4,DRAW_HISTOGRAM,EMPTY,3,BELOW_DN);
   SetIndexLabel(4,NULL);

   SetIndexBuffer(5,SHARK_BUFFER_UP_DN,INDICATOR_DATA);
   SetIndexStyle(5,DRAW_HISTOGRAM,EMPTY,3,ABOVE_DN);
   SetIndexLabel(5,NULL);

   SetIndexBuffer(6,SHARK_BUFFER_DN_UP,INDICATOR_DATA);
   SetIndexStyle(6,DRAW_HISTOGRAM,EMPTY,3,BELOW_UP);
   SetIndexLabel(6,NULL);


   IndicatorShortName("SHARK_MACD_CLASSIC_V.21"+"( "+ FAST_LENGTH + " " + SLOW_LENGTH + " " +PriceTypeToString(SOURCE)+" " + SIGNAL_SMOOTHING +" " +  _MA_METHOD_TYPETOSTRING(OSCILLATOR_MA_TYPE)+" " + _MA_METHOD_TYPETOSTRING(SIGNAL_LINE_MA_TYPE) +  " )");
//--- check for input parameters
   if(FAST_LENGTH <=1 || SLOW_LENGTH <=1 || SIGNAL_SMOOTHING<=1 || FAST_LENGTH >= SLOW_LENGTH)
     {
      Print("Wrong input parameters");
      ExtParameters=false;
      return(INIT_FAILED);
     }
   else
      ExtParameters=true;
//--- initialization done
   return(INIT_SUCCEEDED);
  }



//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int deinit()
  {

//ObjectsDeleteAll();
//deleteArrows();
   return(0);
  }

//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted(),limit,i;

   if(counted_bars<0)
      return(-1);
   if(counted_bars>0)
      counted_bars--;

   limit=MathMin(Bars-counted_bars,Bars-1);

   for(i = limit; i >= 0 && !IsStopped(); i--)
     {
      //+------------------------------------------------------------------+
      //| SHARK_BUFFER                                                     |
      //+------------------------------------------------------------------+

      SHARK_BUFFER_M[i] = iMA(Symbol(),Period(),FAST_LENGTH,0,OSCILLATOR_MA_TYPE,PRICE_CLOSE,i)-iMA(Symbol(),Period(), SLOW_LENGTH,0,OSCILLATOR_MA_TYPE,PRICE_CLOSE,i);
      SHARK_BUFFER_S[i] = iMAOnArray(SHARK_BUFFER_M,0,SIGNAL_SMOOTHING,0,SIGNAL_LINE_MA_TYPE,i);
      SHARK_BUFFER_T[i] = (SHARK_BUFFER_M[i] - SHARK_BUFFER_S[i]);

      //+------------------------------------------------------------------+
      //| SHARK_TREND_UP                                                   |
      //+------------------------------------------------------------------+
      if((SHARK_BUFFER_T[i] > 0)&& (SHARK_BUFFER_T[i+1] < SHARK_BUFFER_T[i]))
        {
         SHARK_BUFFER_UP[i]=SHARK_BUFFER_T[i];
        }
      else
         if((SHARK_BUFFER_T[i] > 0)&& (SHARK_BUFFER_T[i+1] > SHARK_BUFFER_T[i]))
           {
            SHARK_BUFFER_UP_DN[i]=SHARK_BUFFER_T[i];
           }
      //+------------------------------------------------------------------+
      //| SHARK_TREND_DN                                                   |
      //+------------------------------------------------------------------+
      if((SHARK_BUFFER_T[i] < 0)&& (SHARK_BUFFER_T[i+1] > SHARK_BUFFER_T[i]))
        {
         SHARK_BUFFER_DN[i]=SHARK_BUFFER_T[i];
        }
      else
         if((SHARK_BUFFER_T[i] < 0)&& (SHARK_BUFFER_T[i+1] < SHARK_BUFFER_T[i]))
           {
            SHARK_BUFFER_DN_UP[i]=SHARK_BUFFER_T[i];
           }

      //+------------------------------------------------------------------+
      //| ALERTSIGNALE                                                     |
      //+------------------------------------------------------------------+
      if((SHARK_BUFFER_M[i] >= 0) && (SHARK_BUFFER_S[i] >= 0))
         if((SHARK_BUFFER_T[i+1] > 0)&&(SHARK_BUFFER_T[i] < 0))
           {
            if(i == 0 && Time[0] != time_alert)
              {
               Alert("SIGNAL","SHORT",Symbol(),Bid);
               time_alert = Time[0];
              }

            if((SHARK_BUFFER_M[i] <= 0) && (SHARK_BUFFER_S[i] <= 0))
            if((SHARK_BUFFER_T[i+1] < 0) && (SHARK_BUFFER_T[i] > 0))
              {
               if(i == 0 && Time[0] != time_alert)
                 {
                  _MACD_Alert("SIGNAL","LONG",Symbol(),Ask);
                  time_alert = Time[0];
                 }
              }

           }



     }

   return(0);
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
string _MA_METHOD_TYPETOSTRING(int MATYP)
  {
   string Typ;
   switch(MATYP)
     {
      case 0:
         Typ = "SMA"    ;
         break;
      case 1:
         Typ = "EMA"    ;
         break;
      default:
         Typ = "Invalid price field requested";
         Alert(Typ);
     }
   return(Typ);
  }

//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
string PriceTypeToString(int pt)
  {
   string answer;
   switch(pt)
     {
      case 0:
         answer = "Close"    ;
         break;
      case 1:
         answer = "Open"     ;
         break;
      case 2:
         answer = "High"     ;
         break;
      case 3:
         answer = "Low"      ;
         break;
      case 4:
         answer = "Median"   ;
         break;
      case 5:
         answer = "Typical"  ;
         break;
      case 6:
         answer = "Wighted"  ;
         break;
      default:
         answer = "Invalid price field requested";
         Alert(answer);
     }
   return(answer);
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| ALERT                                                            |
//+------------------------------------------------------------------+
void _MACD_Alert(string Type, string Messagetyp,string Paar, double Price)
  {
   string Temp_Message = "Live "+" "+Type +" "+ Messagetyp + ":"+Paar+" " +Price;
   if(Type == "Print")
      Print(Messagetyp);
   else
      if(Type == "Error")
        {
         Print(Type+" | MACD @ "+Symbol()+","+IntegerToString(Period())+" | "+Messagetyp);
        }
      else
         if(Type == "SIGNAL")
           {
            if(PopupAlerts)
               Alert(Temp_Message);
           }

  }
//+------------------------------------------------------------------+


/*
//+------------------------------------------------------------------+
//| noch in arbeit                                                   |
//+------------------------------------------------------------------+
void drawArrow(int i,color theColor,int theCode,bool up)
  {
   string name = "SHARK_RSI_CLASSIC_V.21"+":"+Time[i];
   double gap  = 3.0*iATR(NULL,0,10,i)/4.0; //20

   ObjectCreate(name,OBJ_ARROW,0,Time[i],0);
   ObjectSet(name,OBJPROP_ARROWCODE,theCode);
   ObjectSet(name,OBJPROP_COLOR,theColor);
   ObjectSet(name,OBJPROP_WIDTH,1);
   if(up)
      ObjectSet(name,OBJPROP_PRICE1,High[i]+gap);
   else
      ObjectSet(name,OBJPROP_PRICE1,Low[i] -gap);
  }


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void deleteArrows()
  {
   string lookFor       = "SHARK_RSI_CLASSIC_V.21"+":";
   int    lookForLength = StringLen(lookFor);
   for(int i=ObjectsTotal()-1; i>=0; i--)
     {
      string objectName = ObjectName(i);
      if(StringSubstr(objectName,0,lookForLength) == lookFor)
         ObjectDelete(objectName);
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void deleteArrow(datetime time)
  {
   string lookFor ="SHARK_RSI_CLASSIC_V.21"+":"+time;
   ObjectDelete(lookFor);
  }


//+------------------------------------------------------------------+
*/

Geändert von Sirocool (07.12.21 um 16:51 Uhr)
Mit Zitat antworten
  #8 (permalink)  
Alt vor einer Woche
Mitglied
 
Registriert seit: Feb 2014
Ort: Berlin
Beiträge: 42
Sirocool befindet sich auf einem aufstrebenden Ast
Standard Projekt RSI

RSI wurde bearbeitet aber den Fehler das die Signal mal unten angzeigt werden und mal oben kann ich noch nicht beantworten bei folgen Symbolen kommen die Signale oben Gold;Eth bei Symbolen kommen Signale nur unten :-( EURUSD,u.s.w.

Overbought & Oversould Linien sind zu
100 %

Signale für Sell und Buy sind zu
100 %

Show Arrows zu
85 %

Alert zu
0%

Telegramm
0%

Preislinie zu
0%

RSI Channel zu
0% da ich erstmal schauen muss wie ich das Transperrent bekomme und das es Nicht an der Aktuellen Kerze stehen bleibt und erst wandert wenn die kerze vorbei ist.

Bild kommt dazu wie es jetzt auszieht und wie ich es haben möchte :-).

Code:
//+------------------------------------------------------------------+
//|                 SHARK_RSI_CLASSIC_V.22 - 0122                    |
//|                         Copyright 2020                           |
//|                     www.expert-advisor.com                       |
//+------------------------------------------------------------------+

#property copyright "Sirocool"
#property link      "http://www.expert-advisor.com/forum/members/sirocool.html"

//#property icon "\\Images\\Icon\\Shark.ico"

extern string  a_SHARK_SETTINGS ="~~* RSI Settings *~~";

extern int Fast_Length = 14;
extern int Over_Up = 30;
extern int Over_Dn = 70;

extern ENUM_APPLIED_PRICE SOURCE = PRICE_CLOSE;

extern string  b_SHARK_SETTINGS ="~~* RSI Settings Styl *~~";



extern string  c_SHARK_SETTINGS ="~~* RSI Settings Alert *~~";

extern bool ShowArrows    = true;


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

#property indicator_separate_window
#property indicator_buffers  3

#property indicator_minimum 0
#property indicator_maximum 100

//+------------------------------------------------------------------+
//| ENUM_APPLIED_PRICE                                               |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
string PriceTypeToString(int pt)
  {
   string answer;
   switch(pt)
     {
      case 0:
         answer = "Close"    ;
         break;
      case 1:
         answer = "Open"     ;
         break;
      case 2:
         answer = "High"     ;
         break;
      case 3:
         answer = "Low"      ;
         break;
      case 4:
         answer = "Median"   ;
         break;
      case 5:
         answer = "Typical"  ;
         break;
      case 6:
         answer = "Wighted"  ;
         break;
      default:
         answer = "Invalid price field requested";
         Alert(answer);
     }
   return(answer);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| IndicatorShortName                                               |
//+------------------------------------------------------------------+
string Name ="SHARK_RSI_CLASSIC_V.21"+"( "+ Fast_Length +","+PriceTypeToString(SOURCE)+","+ Over_Up+","+Over_Dn+")";
int windowIndex=WindowFind(Name),maxArrows;

//==================================== rectangle names
string NameTopLev=windowIndex+"LevelTop";       //50 -
string NameWaitUp=windowIndex+"LevelWaitTop";   // 55
string NameWaitLo=windowIndex+"LevelWaitBot";   //-45
string NameBotLev=windowIndex+"LevelBot";       //30




double SHARK_BUFFER_M[],SHARK_BUFFER_ARROW_UP[],SHARK_BUFFER_ARROW_DN[];
bool ExtParameters=false, initFinished=false;

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(3);
   IndicatorDigits(Digits);//max. 2

   SetIndexBuffer(0,SHARK_BUFFER_M,INDICATOR_DATA); // RSI_LINIE
   SetIndexStyle(0,DRAW_LINE,EMPTY,1,clrRoyalBlue);
   SetIndexDrawBegin(0,Fast_Length);
   SetIndexLabel(0,"RSI");

   SetIndexBuffer(1,SHARK_BUFFER_ARROW_UP,INDICATOR_DATA);
   SetIndexStyle(1, DRAW_ARROW, EMPTY,1,clrForestGreen);
   SetIndexArrow(1, 241);
   SetIndexLabel(1,NULL);

   SetIndexBuffer(2,SHARK_BUFFER_ARROW_DN,INDICATOR_DATA);
   SetIndexStyle(2, DRAW_ARROW, EMPTY,1,clrFireBrick);
   SetIndexArrow(2, 242);
   SetIndexLabel(2,NULL);


   if(Fast_Length<=1)
     {
      Print("Wrong input parameters");
      ExtParameters=false;
      return(INIT_FAILED);
     }
   else
      ExtParameters=true;

   return(INIT_SUCCEEDED);

   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int deinit()
  {
   DeleteArrows();
//ObjectsDeleteAll();
//ObjectDelete();
//deleteArrows();
   return(0);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
   _Overlines(Over_Up,Over_Dn,false);



   int counted_bars=IndicatorCounted(),limit,i;

   if(counted_bars<0)
      return(-1);
   if(counted_bars>0)
      counted_bars--;

   limit=MathMin(Bars-counted_bars,Bars-1);

   for(i = limit; i >= 0 && !IsStopped(); i--)
     {
      SHARK_BUFFER_M[i] = iRSI(Symbol(),Period(),Fast_Length,SOURCE,i);

      //+------------------------------------------------------------------+
      //| SHARK_SHOW_ARROWS                                                |
      //+------------------------------------------------------------------+
      if(ShowArrows)
        {
         //+------------------------------------------------------------------+
         //| SHARK_SHORT_SIGNAL                                               |
         //+------------------------------------------------------------------+
         if((SHARK_BUFFER_M[i] < Over_Dn) && (SHARK_BUFFER_M[i+1] > Over_Dn))
           {
            SHARK_BUFFER_ARROW_DN[i+1] = High[i+1]+90;
           }
         if((SHARK_BUFFER_M[i] < Over_Dn) && (SHARK_BUFFER_M[i+1] > Over_Dn))
           {
            DrawArrow(i+1,"Dn");
           }
         //+------------------------------------------------------------------+
         //| SHARK_LONG_SIGNAL                                                |
         //+------------------------------------------------------------------+
         if((SHARK_BUFFER_M[i] > Over_Up) && (SHARK_BUFFER_M[i+1] < Over_Up))
           {
            SHARK_BUFFER_ARROW_UP[i+1] = Low[i+1]+5;
           }
         if((SHARK_BUFFER_M[i] > Over_Up) && (SHARK_BUFFER_M[i+1] < Over_Up))
           {
            DrawArrow(i+1,"Up");
           }

        }

     }

   return(0);
  }
//+------------------------------------------------------------------+
//| Extras                                                           |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Overline 70 / 30                                                 |
//+------------------------------------------------------------------+
void _Overlines(int Up, int Dn)
  {
   if(initFinished==false)
     {
      IndicatorShortName(Name);
      windowIndex=WindowFind(Name);

      if(windowIndex<0)
        {
         Print("Can\'t find window");
         return;
        }
      ObjectCreate("OVERSOLDLINE",OBJ_HLINE,windowIndex,0,Up);
      ObjectSet("OVERSOLDLINE",OBJPROP_COLOR,clrGreen);
      ObjectSet("OVERSOLDLINE",OBJPROP_WIDTH,1);
      ObjectSet("OVERSOLDLINE",OBJPROP_STYLE,STYLE_DOT);
      
      ObjectCreate("SHORTLINE",OBJ_HLINE,windowIndex,0,Up+10);
      ObjectSet("SHORTLINE",OBJPROP_COLOR,C'128,128,128');
      ObjectSet("SHORTLINE",OBJPROP_WIDTH,1);
      ObjectSet("SHORTLINE",OBJPROP_STYLE,STYLE_DOT);
      
      ObjectCreate("LONGLINE",OBJ_HLINE,windowIndex,0,Dn-10);
      ObjectSet("LONGLINE",OBJPROP_COLOR,C'128,128,128');
      ObjectSet("LONGLINE",OBJPROP_WIDTH,1);
      ObjectSet("LONGLINE",OBJPROP_STYLE,STYLE_DOT);

      ObjectCreate("OVERBOUGHTLINE",OBJ_HLINE,windowIndex,0,Dn);
      ObjectSet("OVERBOUGHTLINE",OBJPROP_COLOR,clrRed);
      ObjectSet("OVERBOUGHTLINE",OBJPROP_WIDTH,1);
      ObjectSet("OVERBOUGHTLINE",OBJPROP_STYLE,STYLE_DOT); 
     }
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Show Arrows                                                      |
//+------------------------------------------------------------------+
void DrawArrow(int i,string type)
  {
   maxArrows++;
   ObjectCreate("RSISignal"+maxArrows,OBJ_ARROW,0,Time[i],0);
   if(type=="Dn")
     {
      ObjectSet("RSISignal"+maxArrows,OBJPROP_PRICE1,High[i]+10);
      ObjectSet("RSISignal"+maxArrows,OBJPROP_ARROWCODE,242);
      ObjectSet("RSISignal"+maxArrows,OBJPROP_COLOR,clrRed);
     }
   else
      if(type=="Up")
        {
         ObjectSet("RSISignal"+maxArrows,OBJPROP_PRICE1,Low[i]-10);
         ObjectSet("RSISignal"+maxArrows,OBJPROP_ARROWCODE,241);
         ObjectSet("RSISignal"+maxArrows,OBJPROP_COLOR,clrGreen);
        }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void DeleteArrows()
  {
   while(maxArrows>0)
     {
      ObjectDelete("RSISignal"+maxArrows);
      maxArrows--;
     }
  }


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
Mit Zitat antworten
  #9 (permalink)  
Alt vor einer Woche
Mitglied
 
Registriert seit: Feb 2014
Ort: Berlin
Beiträge: 42
Sirocool befindet sich auf einem aufstrebenden Ast
Standard Update RSI Arrows_Signale

Code:
//+------------------------------------------------------------------+
//|                 SHARK_RSI_CLASSIC_V.22 - 0122                    |
//|                         Copyright 2020                           |
//|                     www.expert-advisor.com                       |
//+------------------------------------------------------------------+

#property copyright "Sirocool"
#property link      "http://www.expert-advisor.com/forum/members/sirocool.html"

//#property icon "\\Images\\Icon\\Shark.ico"

extern string  a_SHARK_SETTINGS ="~~* RSI Settings *~~";

extern int Fast_Length = 14;
extern double Over_Up = 30;
extern double Over_Dn = 70;


extern ENUM_APPLIED_PRICE SOURCE = PRICE_CLOSE;

extern string  b_SHARK_SETTINGS ="~~* RSI Settings Styl *~~";



extern string  c_SHARK_SETTINGS ="~~* RSI Settings Alert *~~";

extern bool ShowArrows    = true;


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

#property indicator_separate_window
#property indicator_buffers  3

#property indicator_minimum 0
#property indicator_maximum 100

//+------------------------------------------------------------------+
//| ENUM_APPLIED_PRICE                                               |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
string PriceTypeToString(int pt)
  {
   string answer;
   switch(pt)
     {
      case 0:
         answer = "Close"    ;
         break;
      case 1:
         answer = "Open"     ;
         break;
      case 2:
         answer = "High"     ;
         break;
      case 3:
         answer = "Low"      ;
         break;
      case 4:
         answer = "Median"   ;
         break;
      case 5:
         answer = "Typical"  ;
         break;
      case 6:
         answer = "Wighted"  ;
         break;
      default:
         answer = "Invalid price field requested";
         Alert(answer);
     }
   return(answer);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| IndicatorShortName                                               |
//+------------------------------------------------------------------+
string Name ="SHARK_RSI_CLASSIC_V.21"+"( "+ Fast_Length +","+PriceTypeToString(SOURCE)+","+ Over_Up+","+Over_Dn+")";
int windowIndex=WindowFind(Name),maxArrows,maxLine;

//==================================== rectangle names
string NameTopLev=windowIndex+"LevelTop";       //50 -
string NameWaitUp=windowIndex+"LevelWaitTop";   // 55
string NameWaitLo=windowIndex+"LevelWaitBot";   //-45
string NameBotLev=windowIndex+"LevelBot";       //30




double SHARK_BUFFER_M[],SHARK_BUFFER_ARROW_UP[],SHARK_BUFFER_ARROW_DN[];
bool ExtParameters=false, initFinished=false;

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(3);
   IndicatorDigits(Digits+1);//max. 2

   SetIndexBuffer(0,SHARK_BUFFER_M,INDICATOR_DATA); // RSI_LINIE
   SetIndexStyle(0,DRAW_LINE,EMPTY,1,clrRoyalBlue);
   SetIndexDrawBegin(0,Fast_Length);
   SetIndexLabel(0,"RSI");

   SetIndexBuffer(1,SHARK_BUFFER_ARROW_UP,INDICATOR_DATA);
   SetIndexStyle(1, DRAW_ARROW, EMPTY,1,clrForestGreen);
   SetIndexArrow(1, 241);
   SetIndexLabel(1,NULL);

   SetIndexBuffer(2,SHARK_BUFFER_ARROW_DN,INDICATOR_DATA);
   SetIndexStyle(2, DRAW_ARROW, EMPTY,1,clrFireBrick);
   SetIndexArrow(2, 242);
   SetIndexLabel(2,NULL);


   if(Fast_Length<=1)
     {
      Print("Wrong input parameters");
      ExtParameters=false;
      return(INIT_FAILED);
     }
   else
      ExtParameters=true;

   return(INIT_SUCCEEDED);

   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int deinit()
  {
   _DeleteArrows();
   ObjectDelete("SoldLine");
   ObjectDelete("BuyLine");
   ObjectDelete("SellLine");
   ObjectDelete("BoughtLine");

//ObjectsDeleteAll();
//ObjectDelete();
//deleteArrows();
   return(0);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
   _Overlines(Over_Up,Over_Dn);



   int counted_bars=IndicatorCounted(),limit,i;

   if(counted_bars<0)
      return(-1);
   if(counted_bars>0)
      counted_bars--;

   limit=MathMin(Bars-counted_bars,Bars-1);

   for(i = limit; i >= 0 && !IsStopped(); i--)
     {
      SHARK_BUFFER_M[i] = iRSI(Symbol(),Period(),Fast_Length,SOURCE,i);
      double Lower=iFractals(NULL,0,MODE_LOWER,i);
      double Upper=iFractals(NULL,0,MODE_UPPER,i);

      //+------------------------------------------------------------------+
      //| SHARK_SHOW_ARROWS                                                |
      //+------------------------------------------------------------------+
      if(ShowArrows)
        {
         //+------------------------------------------------------------------+
         //| SHARK_SHORT_SIGNAL                                               |
         //+------------------------------------------------------------------+
         if((SHARK_BUFFER_M[i] < Over_Dn) && (SHARK_BUFFER_M[i+1] > Over_Dn))
           {
            SHARK_BUFFER_ARROW_DN[i+1] = Upper+95;
            DrawArrow(i+1,"Dn",Upper);
           }
         //+------------------------------------------------------------------+
         //| SHARK_LONG_SIGNAL                                                |
         //+------------------------------------------------------------------+
         if((SHARK_BUFFER_M[i] > Over_Up) && (SHARK_BUFFER_M[i+1] < Over_Up))
           {
            SHARK_BUFFER_ARROW_UP[i+1] = Lower+5;
            DrawArrow(i+1,"Up",Lower);
           }
        }
      //+------------------------------------------------------------------+
     }
   return(0);
  }
//+------------------------------------------------------------------+
//| Extras                                                           |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Overline 70 / 30                                                 |
//+------------------------------------------------------------------+
void _Overlines(int Up, int Dn)
  {
   if(initFinished==false)
     {
      IndicatorShortName(Name);
      windowIndex=WindowFind(Name);

      if(windowIndex<0)
        {
         Print("Can\'t find window");
         return;
        }
      ObjectCreate("SoldLine",OBJ_HLINE,windowIndex,0,Up);
      ObjectSet("SoldLine",OBJPROP_COLOR,clrGreen);
      ObjectSet("SoldLine",OBJPROP_WIDTH,1);
      ObjectSet("SoldLine",OBJPROP_STYLE,STYLE_DOT);

      ObjectCreate("BuyLine",OBJ_HLINE,windowIndex,0,Up+10);
      ObjectSet("BuyLine",OBJPROP_COLOR,C'128,128,128');
      ObjectSet("BuyLine",OBJPROP_WIDTH,1);
      ObjectSet("BuyLine",OBJPROP_STYLE,STYLE_DOT);

      ObjectCreate("SellLine",OBJ_HLINE,windowIndex,0,Dn-10);
      ObjectSet("SellLine",OBJPROP_COLOR,C'128,128,128');
      ObjectSet("SellLine",OBJPROP_WIDTH,1);
      ObjectSet("SellLine",OBJPROP_STYLE,STYLE_DOT);

      ObjectCreate("BoughtLine",OBJ_HLINE,windowIndex,0,Dn);
      ObjectSet("BoughtLine",OBJPROP_COLOR,clrRed);
      ObjectSet("BoughtLine",OBJPROP_WIDTH,1);
      ObjectSet("BoughtLine",OBJPROP_STYLE,STYLE_DOT);
     }
  }

//+------------------------------------------------------------------+
//| Show Arrows                                                      |
//+------------------------------------------------------------------+
void DrawArrow(int i,string type, double grap)
  {
   maxArrows++;
   ObjectCreate("RSISignal"+maxArrows,OBJ_ARROW,0,Time[i],0);
   if(type=="Dn")
     {
      ObjectSet("RSISignal"+maxArrows,OBJPROP_PRICE1,grap);
      ObjectSet("RSISignal"+maxArrows,OBJPROP_ARROWCODE,242);
      ObjectSet("RSISignal"+maxArrows,OBJPROP_COLOR,clrRed);
     }
   else
      if(type=="Up")
        {
         ObjectSet("RSISignal"+maxArrows,OBJPROP_PRICE1,grap);
         ObjectSet("RSISignal"+maxArrows,OBJPROP_ARROWCODE,241);
         ObjectSet("RSISignal"+maxArrows,OBJPROP_COLOR,clrGreen);
        }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void _DeleteArrows()
  {
   while(maxArrows>0)
     {
      ObjectDelete("RSISignal"+maxArrows);
      maxArrows--;
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are aus
Pingbacks are aus
Refbacks are aus




Alle Zeitangaben in WEZ +1. Es ist jetzt 03:13 Uhr.





Die Suchmaschine - Der Wavesnode - Facebook Forum - Spam Firewall
-----------------------------------------------------------------------------------------------------------------------------
Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
Powered by vBCMS® 2.7.0 ©2002 - 2022 vbdesigns.de
SEO by vBSEO 3.6.1
Copyright ©2009 - 2020 by Expert-Advisor.com - Das Metatrader Forum
MetaTrader bzw. MetaTrader 4 und MetaTrader 5 sind eingetragene Marken der MetaQuotes Software Corp.
-----------------------------------------------------------------------------------------------------------------------------