Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools
Zurück   Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools > Metatrader 4 > Programmierung MQL4
Startseite Registrieren Hilfe Community Kalender Heutige Beiträge Suchen

Programmierung MQL4 Hier gehts rund ums Programmieren in MQL4.

Login
Benutzername:
Kennwort:


Statistik
Themen: 4978
Beiträge: 43268
Benutzer: 7.224
Aktive Benutzer: 74
Links: 84
Wir begrüßen unseren neuesten Benutzer: Sundaytrader
Mit 2.475 Benutzern waren die meisten Benutzer gleichzeitig online (16.01.20 um 22:38).
Neue Benutzer:
vor 16 Stunden
- Sundaytrad...
vor 22 Stunden
- TS_6
vor 3 Tagen
- Mane
vor 2 Wochen
- AlbertZiz
vor 2 Wochen
- michak

Onlineuser
'Wer ist online' anzeigen Benutzer: 0
Gäste: 343
Gesamt: 343
Team: 0
Team:  
Benutzer:  
Freunde anzeigen

Empfehlungen

Like Tree1Likes
  • 1 Post By Sirocool
Thema geschlossen
 
Themen-Optionen Thema durchsuchen Ansicht
  #1 (permalink)  
Alt 29.03.20
Mitglied
 
Registriert seit: Feb 2014
Ort: Berlin
Beiträge: 42
Sirocool befindet sich auf einem aufstrebenden Ast
Standard Hilfe beim Indikator bauen

Hey Leute ich bräuchte mal Hilfe bei was bin neu Hier und probiere gerade mal was aus.

der Indikator berechnet drei Indikatoren (RSI;STOCH;CCI) und soll mir das unten dann anzeigen wie beim RSI in einer Linie die auch zickzack macht und nicht gerade durchgeht. Wäre euch dankbar dabei mir mal zuhelfen

[IMG]blob:https://mega.nz/12aa580d-0748-43e5-9e10-34e66155dc77[/IMG]

und hier der Mql4 Code

Code:
//+------------------------------------------------------------------+
//|                                                            2.mq4 |
//|                                          M.Streit Copyright 2020 |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "M.Streit Copyright 2020"
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_separate_window
//#property indicator_chart_window
#property indicator_buffers 1
#property indicator_width1  1
#property indicator_width2  1
#property indicator_minimum -200
#property indicator_maximum 200



double tops[];
double bottoms[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
IndicatorShortName("Beta2020");  
  
SetIndexBuffer(0,tops);
SetIndexStyle(0,DRAW_LINE,EMPTY,1,clrBlue);
SetIndexLabel(0,"tops");

SetIndexBuffer(1,bottoms);
SetIndexStyle(1,DRAW_LINE);
SetIndexLabel(0,"bottoms");
   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[])
  {
/* Berechnung des Indikatorwertes den er ausgeben soll */  
double RSIWert = DoubleToStr(iRSI(Symbol(),0,14,PRICE_CLOSE,1),2);
double CCIWERT = DoubleToStr(iCCI(Symbol(),0,14,PRICE_CLOSE,0),2);
double SToWERT = DoubleToStr(iStochastic(Symbol(),0,14,3,3,MODE_SMA,0,MODE_MAIN,0),2);
/* Ausgabewert den er ausgeben soll */ 
double DWert = DoubleToStr((SToWERT+RSIWert+CCIWERT)/3,2);
  
 for(int i=Bars-1;i>=0;i--)
 {
 tops[i]=DWert;
 //bottoms[i]=Low[i];
 }
   
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
//---
   
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//---
   
  }
//+------------------------------------------------------------------+
Mit freundlichen Grüßen

Sirocool
  #2 (permalink)  
Alt 30.03.20
AVT AVT ist offline
Elite Mitglied
 
Registriert seit: Mar 2018
Ort: Hamburg
Beiträge: 612
AVT befindet sich auf einem aufstrebenden Ast
Standard

Zitat:
Zitat von Sirocool Beitrag anzeigen
der Indikator berechnet drei Indikatoren (RSI;STOCH;CCI) und soll mir das unten dann anzeigen wie beim RSI in einer Linie die auch zickzack macht und nicht gerade durchgeht. Wäre euch dankbar dabei mir mal zuhelfen l
Ich kann mir etwa denken, was Du vorhast. Problem dabei:
  1. RSI und Stochastic haben feste Grenzen - nämlich 100 und -100.
  2. CCI geht über diese Werte hinaus - und wenn das passiert, bedeutet das bei >100 Longtrend und bei <-100 Shorttrend.
    Übrigens: ein Max/Miin bei 200/-200 geht nicht, der CCI kann durchaus höhere Werte haben (sieh Dir mal CCI(14) im DAX Daily/Weekly an).
Man könnte den ersten Punkt umrechnen, dazu müßte man aber definieren, ab welchem Level bei RSI und Stochastic der Trend beginnt - das entspricht z.B. einer Interpretation, die sagt "Long wenn RSI über 80 und Short wenn RSI unter 20".

Ich hab schon mal ne "Arbeitsversion" nach dem gemacht, was ich in Deinem Code gefunden habe, aber bisher sieht die Linie nur etwas unruhiger als ein CCI(14) aus.

Zitat:
[IMG]blob:https://mega.nz/12aa580d-0748-43e5-9e10-34e66155dc77[/IMG]
Da gibt es nur Reklame für meag.nz zu sehen, sonst nix.
AVT
  #3 (permalink)  
Alt 30.03.20
Mitglied
 
Registriert seit: Feb 2014
Ort: Berlin
Beiträge: 42
Sirocool befindet sich auf einem aufstrebenden Ast
Standard Brauche Hilfe beim Indikator erstellen




Bild wurde Bearbeitet nicht mehr bei Mega.nz in meiner Cloud müsste jetzt gehen.

Mit freundlichen Grüßen

Sirocool[/QUOTE]
  #4 (permalink)  
Alt 30.03.20
AVT AVT ist offline
Elite Mitglied
 
Registriert seit: Mar 2018
Ort: Hamburg
Beiträge: 612
AVT befindet sich auf einem aufstrebenden Ast
Standard

Ich habe den Indi mal gebaut (einzige Abweichung: iRSI(Symbol(),0,14,PRICE_CLOSE,1) => iRSI(Symbol(),0,14,PRICE_CLOSE,0) weil die anderen beiden auch den aktuellen Wert nehmen).
Probier's mal aus, ob Du Dir das so gedacht hast.
AVT
Angehängte Dateien
Dateityp: ex4 BiSi-OSC-C.R.S.Comb.ex4 (27,7 KB, 4x aufgerufen)
  #5 (permalink)  
Alt 31.03.20
Mitglied
 
Registriert seit: Feb 2014
Ort: Berlin
Beiträge: 42
Sirocool befindet sich auf einem aufstrebenden Ast
Standard Ich glaube ich ahbe die lösung raus

hie mal der Mql4code






3.jpg


Code:
//
#property copyright ""
#property link      ""
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_minimum -200
#property indicator_maximum  200
#property indicator_color1 Black
extern int barsToProcess=100;
double ExtMapBuffer1[];

int init()
{
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   MathSrand(TimeLocal());
   return(0);
}

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

int start()
{


MathSrand(GetTickCount());
double RSIWert = iRSI(Symbol(),0,14,PRICE_CLOSE,1);
double CCIWERT = iCCI(Symbol(),0,14,PRICE_CLOSE,0); //DoubleToStr("",2);
double SToWERT = iStochastic(Symbol(),0,14,3,3,MODE_SMA,0,MODE_MAIN,0);
double DWert = (SToWERT+RSIWert+CCIWERT)/3;

   int counted_bars=IndicatorCounted(),
       limit;
 
   if(counted_bars>0)
      counted_bars--;
   
   limit=Bars-counted_bars;
   
   if(limit>barsToProcess)
      limit=barsToProcess;
  
   for(int i=0;i<limit;i++)
   {
      ExtMapBuffer1[i]=DWert*MathRand()/32767;//MathRand()%2; //MathSrand(GetTickCount());  //MathRand()%1001;
   }
   
   return(0);
}

Geändert von Sirocool (31.03.20 um 12:24 Uhr)
  #6 (permalink)  
Alt 06.04.20
Mitglied
 
Registriert seit: Feb 2014
Ort: Berlin
Beiträge: 42
Sirocool befindet sich auf einem aufstrebenden Ast
Standard So ist Fertig





Code:
//
#property copyright ""
#property link      ""
#property indicator_separate_window
#property indicator_buffers 3


#property indicator_minimum -20
#property indicator_maximum  20

extern int barsToProcess=100;
double TrendUp[], TrendDn[],SignalUp[];

string indicatorFileName;


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

   SetIndexBuffer(0,SignalUp);SetIndexStyle(0,DRAW_LINE,EMPTY,0,clrBlack);
   SetIndexBuffer(1,TrendUp);SetIndexStyle(1,DRAW_LINE,EMPTY,0,clrRed);
   SetIndexBuffer(2,TrendDn);SetIndexStyle(2,DRAW_LINE,EMPTY,0,clrGreen);
   
   
  indicatorFileName = WindowExpertName();
      
    
         
  IndicatorShortName("Score 2020 " + "Signalwert:");
   
   
   
   
   
   MathSrand(TimeLocal());
   return(0);
}

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

int start()
{



   int counted_bars=IndicatorCounted(),
       limit;
 
   if(counted_bars>0)
      counted_bars--;
   
   limit=Bars-counted_bars;
   
   if(limit>barsToProcess)
      limit=barsToProcess;
    
    

   for(int i=0;i<limit;i++)
   {
   double Scoreindex = 0;
   
   
   double cci = iCCI(NULL,0,14,PRICE_TYPICAL,i);
               if (cci < -100) Scoreindex -=5;
               if (cci >  100) Scoreindex +=5;

         double rsi = iRSI(NULL,0,14,PRICE_CLOSE,i);
               if (rsi < 30) Scoreindex -=5;
               if (rsi > 70) Scoreindex +=5;
               
         double stoFastK = iStochastic(NULL,0,14,3,1,MODE_EMA,0,MODE_MAIN  ,i);
         double stoFastD = iStochastic(NULL,0,14,3,1,MODE_EMA,0,MODE_SIGNAL,i);
               if (stoFastK < 20) Scoreindex -=5;
               if (stoFastK > 80) Scoreindex +=5;
               if (stoFastD < 20) Scoreindex -=5;
               if (stoFastD > 80) Scoreindex +=5;
   
   
   /*
   
   if( insyncScore>=20)
   {
   TrendUp[i]=DoubleToStr(insyncScore,2);//iCCI(Symbol(),0,14,PRICE_CLOSE,i);
   }
   if( insyncScore>=-20)SetIndexStyle(3,DRAW_LINE,EMPTY,EMPTY,clrGreen);
   {
   SignalUp[i]=DoubleToStr(insyncScore,2);//iCCI(Symbol(),0,14,PRICE_CLOSE,i);
   }
   */
   if(Scoreindex>+0)TrendUp[i]=DoubleToStr(Scoreindex,2);
   if(Scoreindex<-0)TrendDn[i]=DoubleToStr(Scoreindex,2);
   //if(Scoreindex=0)SignalUp[i]=DoubleToStr(Scoreindex,2);
  SignalUp[i]=DoubleToStr(Scoreindex,2);
 
   }
   
   return(0);
}




/*




*/
AVT likes this.
  #7 (permalink)  
Alt 06.04.20
AVT AVT ist offline
Elite Mitglied
 
Registriert seit: Mar 2018
Ort: Hamburg
Beiträge: 612
AVT befindet sich auf einem aufstrebenden Ast
Standard

Gefällt mir sehr gut, Deine Stufenlösung
AVT
  #8 (permalink)  
Alt 15.04.20
Mitglied
 
Registriert seit: Feb 2014
Ort: Berlin
Beiträge: 42
Sirocool befindet sich auf einem aufstrebenden Ast
Standard Update Indikator berechnet jetzt auch Alte kerzen verläufe






Code:
//
#property copyright ""
#property link      ""
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_style1  STYLE_DOT
#property indicator_style2  STYLE_DOT
#property indicator_style3  STYLE_DOT
#property indicator_minimum -30
#property indicator_maximum  30
#property indicator_level1    -20
#property indicator_level2     0
#property indicator_level3     20

#property indicator_levelcolor clrSilver
#property indicator_levelstyle STYLE_DOT


extern int barsToProcess=100;
double TrendUp[], TrendDn[],SignalUp[];

string indicatorFileName;

string Lizenzcode = "12104499";

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
{
//if (AccountNumber() != Lizenzcode) return(INIT_FAILED);

   SetIndexBuffer(0,SignalUp);SetIndexStyle(0,DRAW_LINE,0,1,clrBlack);
   SetIndexBuffer(1,TrendUp);SetIndexStyle(1,DRAW_LINE,0,2,clrRed);
   SetIndexBuffer(2,TrendDn);SetIndexStyle(2,DRAW_LINE,0,2,clrGreen);
   
   
  indicatorFileName = WindowExpertName();
      
    
         
  IndicatorShortName("Score 2020 " + "Signalwert:");
   
   
   
   
   
   MathSrand(TimeLocal());
   return(0);
}

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

int start()
{

int i, limit, counted_bars=IndicatorCounted();

   limit=Bars-counted_bars;
   /*limit= MathMin(Bars-counted_bars,Bars-1);//Bars;//MathMin(Bars-counted_bars,Bars-1);//Bars-counted_bars;
         limit=barsToProcess;
     if(counted_bars>0)
      counted_bars--;
       
 // if(limit>barsToProcess);
     
 */
   
   
   

    
    
//for (i=limit, r=Bars-i-1; i>=0; i--,r++)  for(i=limit;i<limit;i++)
  for(i=limit;i>=0;i--)
   {
   double Scoreindex = 0;
   
   
   double cciclose = iCCI(NULL,0,14,PRICE_CLOSE,i);
               if (cciclose < -100) Scoreindex -=5;
               if (cciclose >  100) Scoreindex +=5;
   double cciopen = iCCI(NULL,0,14,PRICE_OPEN,i);
               if (cciopen < -100) Scoreindex -=5;
               if (cciopen >  100) Scoreindex +=5;             

         double rsi = iRSI(NULL,0,14,PRICE_CLOSE,i);
               if (rsi < 20) Scoreindex -=5;
               if (rsi > 70) Scoreindex +=5;
               
         double stoFastK = iStochastic(NULL,0,14,3,1,MODE_EMA,0,MODE_MAIN  ,i);
         double stoFastD = iStochastic(NULL,0,14,3,1,MODE_EMA,0,MODE_SIGNAL,i);
               if (stoFastK < 20) Scoreindex -=5;
               if (stoFastK > 80) Scoreindex +=5;
               if (stoFastD < 20) Scoreindex -=5;
               if (stoFastD > 80) Scoreindex +=5;
   
   

  
   if(Scoreindex>0)TrendUp[i]=DoubleToStr(Scoreindex,2);
   if(Scoreindex<0)TrendDn[i]=DoubleToStr(Scoreindex,2);
   //if(Scoreindex=0)SignalUp[i]=DoubleToStr(Scoreindex,2);
   
   //ExtCCIBuffer[i]=(ExtPriceBuffer[i]-ExtMovBuffer[i])/dSum;
   SignalUp[i]=DoubleToStr(Scoreindex,2);

   }
   
   return(0);
}
  #9 (permalink)  
Alt 08.05.20
Mitglied
 
Registriert seit: Feb 2014
Ort: Berlin
Beiträge: 42
Sirocool befindet sich auf einem aufstrebenden Ast
Standard Updates

Heute mal ein kleines Update für euch werde diesmal keinen Quellcod mit liefern so lange das Hauptproject nicht fertig ist. Wer die ex4 Dateien haben möchte meldet sich einfach bei mir.



Mit freundlichen Grüßen

Sirocool
Thema geschlossen

Lesezeichen


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 +2. Es ist jetzt 10:28 Uhr.





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