|
Startseite | Registrieren | Hilfe | Benutzerliste | Kalender | Suchen | Heutige Beiträge | Alle Foren als gelesen markieren |
Programmierung MQL4 Hier gehts rund ums Programmieren in MQL4. |
|
Themen-Optionen | Thema durchsuchen | Ansicht |
|
|||
Break_Out_Indikator
suche jemanden der mir bei meinen Indikator hilft brauche noch eine Funktion
//+------------------------------------------------------------------+ //| Break_Out.mq4 | //+------------------------------------------------------------------+ #property copyright "Den" #property indicator_chart_window extern int Kerzen = 15; extern int pause = 0; extern double PfeilHochFactor = 0.999; extern double PfeilRunterFactor = 1.001; double hightick,lowtick; bool start = true; bool breaked = false; int counter,tmppause,oldTime; int bigcount=1; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { tmppause = pause; breaked = false; counter = 0; SetLevels(); start=true; oldTime = Time[0]; return(0); } int deinit() { //---- int i, ot=ObjectsTotal()-1; string id; //---- for(i=ot;i>=0;i--) {id=ObjectName(i); if (id=="highlevel"||id=="lowlevel") ObjectDelete(id); if(StringSubstr(id,0,2)=="Up"||StringSubstr(id,0,2 )=="Dn") {ObjectDelete(id); } } return(0); } //+------------------------------------------------------------------+ //| Money Flow Index | //+------------------------------------------------------------------+ int start() { if (breaked){ if(oldTime != Time[0]) { if(tmppause<=0){ breaked = false; tmppause=pause; start = true; } else { oldTime = Time[0]; tmppause--; } } return(0); } //tmppause = pause; int i,nCountedBars; //---- insufficient data if (start) SetLevels(); ChartRedraw(0); RefreshRates(); if (Close[0]>hightick){ string name = "Up"+counter; ObjectCreate(name, OBJ_ARROW, 0, Time[0], Close[0]*PfeilHochFactor); //draw an up arrow ObjectSet(name, OBJPROP_STYLE, STYLE_SOLID); ObjectSet(name, OBJPROP_ARROWCODE, 233); ObjectSet(name, OBJPROP_COLOR,Green); counter++; breaked = true; oldTime = Time[0]; } if (Close[0]<lowtick){ string name2 = "Dn"+counter; ObjectCreate(name2,OBJ_ARROW, 0, Time[0], Close[0]*PfeilRunterFactor); //draw a dn arrow ObjectSet(name2, OBJPROP_STYLE, STYLE_SOLID); ObjectSet(name2, OBJPROP_ARROWCODE, 234); ObjectSet(name2, OBJPROP_COLOR,Red); counter++; breaked = true; oldTime = Time[0]; } Comment(StringFormat("Show prices\nMomentan = %G\nHigLevel = %G\nlowLevel = %G\ncounter = %G\n",Close[0],hightick,lowtick,bigcount)); bigcount++; // if(Bars<=Kerzen) return(0); //---- bars count that does not changed after last indicator launch. //nCountedBars=IndicatorCounted(); return(0); } void SetLevels(){ hightick =0; lowtick = 1000000; for (int i=0;i<Kerzen;i++){ if (High[i]>hightick) hightick = High[i]; if (Low[i]<lowtick) lowtick = Low[i]; } //ObjectCreate("highlevel",OBJ_HLINE,0,Time[0],hightick); ObjectDelete("lowlevel"); ObjectDelete("highlevel"); HLineCreate(0,"lowlevel",0,lowtick,clrBlue,0,1,fal se,true,true,0); HLineCreate(0,"highlevel",0,hightick,clrBlue,0,1,f alse,true,true,0); ChartRedraw(0); //ObjectCreate("lowlevel",OBJ_HLINE,0,Time[0],lowtick); start = false; } bool HLineCreate(const long chart_ID=0, // chart's ID const string name="HLine", // line name const int sub_window=0, // subwindow index double price=0, // line price const color clr=clrBlue, // line color const ENUM_LINE_STYLE style=STYLE_SOLID, // line style const int width=1, // line width const bool back=false, // in the background const bool selection=true, // highlight to move const bool hidden=true, // hidden in the object list const long z_order=0) // priority for mouse click { //--- if the price is not set, set it at the current Bid price level if(!price) price=SymbolInfoDouble(Symbol(),SYMBOL_BID); //--- reset the error value ResetLastError(); //--- create a horizontal line if(!ObjectCreate(chart_ID,name,OBJ_HLINE,sub_windo w,0,price)) { Print(__FUNCTION__, ": failed to create a horizontal line! Error code = ",GetLastError()); return(false); } //--- set line color ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr); //--- set line display style ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style ); //--- set line width ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width ); //--- display in the foreground (false) or background (true) ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back); //--- enable (true) or disable (false) the mode of moving the line by mouse //--- when creating a graphical object using ObjectCreate function, the object cannot be //--- highlighted and moved by default. Inside this method, selection parameter //--- is true by default making it possible to highlight and move the object ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE, selection); ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,se lection); //--- hide (true) or display (false) graphical object name in the object list ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidd en); //--- set the priority for receiving the event of a mouse click in the chart ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_or der); //--- successful execution return(true); } //+------------------------------------------------------------------+ möchte noch eine ränge einbauen weil so er alle Kerzen beobachtet und ich will das er Kerzen beobachtet die in einer bestimmten rang liegen die man selber einstellen kann |
Lesezeichen |
Stichworte |
kerze, kerzen, mql4, programmierung, programmierung metatrader, rang, ränge |
Themen-Optionen | Thema durchsuchen |
Ansicht | |
|
|