Sie verpassen Handelsmöglichkeiten:
- Freie Handelsapplikationen
- Über 8.000 Signale zum Kopieren
- Wirtschaftsnachrichten für die Lage an den Finanzmärkte
Registrierung
Einloggen
Sie stimmen der Website-Richtlinie und den Nutzungsbedingungen zu.
Wenn Sie kein Benutzerkonto haben, registrieren Sie sich
Ich versuche nach dem ZiehenOBJPROP_SELECTED konnte "false" mit untenstehendem Code sein, keine Auswirkungen.
Wie kann ich das Problem lösen, bitte?
{
SL_TPdrags();
Sleep(1000);
drag_onoff=false; // OBJPROP_SELECTED
}
Vielen Dank im Voraus.
Es tut mir leid, dass ich nie CHARTEVENT_OBJECT_DRAG verwende .
Am Ende des Tages habe ich "OBJ_RECTANGLE" und "OBJ_TEXT" gefunden, von denen ich denke, dass ich sie beide anstelle von "OBJ_LABEL" und "OBJ_RECTANGLE_LABEL" verwenden kann, da sie beide zusammen die Gebotszeile verschieben.
F: Welche Objekte sind für das Zusammenführen von Gebotszeilen sehr nützlich, bitte?
Ich brauche wirklich informative Kommentare.
Ich wünsche Ihnen ein schönes Wochenende.
ID
Beschreibung
OBJ_VLINE
Vertikale Linie
OBJ_HLINE
Horizontale Linie
OBJ_TREND
Trendlinie
OBJ_TRENDBYANGLE
Trendlinie nach Winkel
OBJ_ZYKLEN
Zyklus-Linien
OBJ_ARROWED_LINE
Gepfeilte Linie
OBJ_CHANNEL
Äquidistanter Kanal
OBJ_STDDEVCHANNEL
Standardabweichungskanal
OBJ_REGRESSION
Kanal für lineare Regression
OBJ_PITCHFORK
Andrews Pitchfork
OBJ_GANNLINE
Gann-Linie
OBJ_GANNFAN
Gann-Fan
OBJ_GANNGRID
Gann-Gitter
OBJ_FIBO
Fibonacci-Wiederherstellung
OBJ_FIBOTIMES
Fibonacci-Zeitzonen
OBJ_FIBOFAN
Fibonacci-Fächer
OBJ_FIBOARC
Fibonacci-Bögen
OBJ_FIBOCHANNEL
Fibonacci-Kanal
OBJ_EXPANSION
Fibonacci-Ausdehnung
OBJ_ELLIOTWAVE5
Elliott-Motiv-Welle
OBJ_ELLIOTWAVE3
Elliott-Korrekturwelle
OBJ_RECTANGLE
Rechteck
OBJ_TRIANGLE
Dreieck
OBJ_ELLIPSE
Ellipse
OBJ_ARROW_THUMB_UP
Daumen hoch
OBJ_ARROW_THUMB_DOWN
Daumen runter
OBJ_ARROW_UP
Pfeil nach oben
OBJ_ARROW_DOWN
Pfeil nach unten
OBJ_ARROW_STOP
Stopp-Zeichen
OBJ_ARROW_CHECK
Check-Zeichen
OBJ_ARROW_LEFT_PRICE
Linkes Preisschild
OBJ_ARROW_RIGHT_PRICE
Preisschild rechts
OBJ_ARROW_BUY
Kaufen Zeichen
OBJ_ARROW_SELL
Vorzeichen Verkauf
OBJ_ARROW
Pfeil
OBJ_TEXT
Text
OBJ_LABEL
Beschriftung
OBJ_BUTTON
Schaltfläche
OBJ_CHART
Diagramm
OBJ_BITMAP
Bitmap
OBJ_BITMAP_LABEL
Bitmap-Beschriftung
OBJ_EDIT
Bearbeiten
OBJ_EVENT
Das "Event"-Objekt, das einem Ereignis im Wirtschaftskalender entspricht
OBJ_RECTANGLE_LABEL
Das Objekt "Rectangle label" für die Erstellung und Gestaltung der benutzerdefinierten grafischen Oberfläche.
Was meinten Sie mit "zusammenrücken"?
Ich versuche nach dem ZiehenOBJPROP_SELECTED konnte "false" mit untenstehendem Code sein, keine Auswirkungen.
Wie kann ich das Problem lösen, bitte?
{
SL_TPdrags();
Sleep(1000);
drag_onoff=false; // OBJPROP_SELECTED
}
Vielen Dank im Voraus.
Sofern Sie nicht sparam weiter oben testen, wird dieser Code ausgelöst, wenn jede Objekt gezogen wird.
Mein ursprünglicher Code:
{
if(id==CHARTEVENT_OBJECT_DRAG && sparam=="line") // the chart event of dragging the line
Ich kenne/lese bereits eines Ihrer großartigen Beispiele CrossHair.mq4.
Aber ich bin kämpfen, um Bid Preis zu Label, RectLabel Objekte zu geben. Das heißt, ich versuche, Label, RectLabel Objects bewegt sich mit Bid Line zusammen.
Ich brauche nur ein Bild, bitte finden Sie die Anhangsdatei.
Ich wünsche Ihnen alles Gute.
Für die Objekte mit fester Größe: OBJ_BUTTON, OBJ_RECTANGLE_LABEL und OBJ_EDIT legen die Eigenschaften OBJPROP_XDISTANCE und OBJPROP_YDISTANCE die Position des oberen linken Punktes des Objekts relativ zur Kartenecke (OBJPROP_CORNER) fest, von der aus die X- und Y-Koordinaten in Pixeln gezählt werden.
//| rectangle.mq4 |
//| Copyright 2017, Marco vd Heijden, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, Marco vd Heijden, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- create timer
EventSetTimer(1);
//--- create rectangle
RectangleCreate(0,"Rectangle",0,0,0);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//--- destroy timer
EventKillTimer();
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
RectanglePointChange(0,"Rectangle",0,TimeCurrent(),Ask);
}
//+------------------------------------------------------------------+
//| Timer function |
//+------------------------------------------------------------------+
void OnTimer()
{
//---
}
//+------------------------------------------------------------------+
//| Create rectangle by the given coordinates |
//+------------------------------------------------------------------+
bool RectangleCreate(const long chart_ID=0, // chart's ID
const string name="Rectangle", // rectangle name
const int sub_window=0, // subwindow index
datetime time1=0, // first point time
double price1=0, // first point price
datetime time2=0, // second point time
double price2=0, // second point price
const color clr=clrRed, // rectangle color
const ENUM_LINE_STYLE style=STYLE_SOLID, // style of rectangle lines
const int width=1, // width of rectangle lines
const bool fill=false, // filling rectangle with color
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
{
//--- set anchor points' coordinates if they are not set
ChangeRectangleEmptyPoints(time1,price1,time2,price2);
//--- reset the error value
ResetLastError();
//--- create a rectangle by the given coordinates
if(!ObjectCreate(chart_ID,name,OBJ_RECTANGLE,sub_window,time1,price1,time2,price2))
{
Print(__FUNCTION__,
": failed to create a rectangle! Error code = ",GetLastError());
return(false);
}
//--- set rectangle color
ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- set the style of rectangle lines
ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
//--- set width of the rectangle lines
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 highlighting the rectangle for moving
//--- 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,selection);
//--- hide (true) or display (false) graphical object name in the object list
ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the priority for receiving the event of a mouse click in the chart
ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful execution
return(true);
}
//+------------------------------------------------------------------+
//| Move the rectangle anchor point |
//+------------------------------------------------------------------+
bool RectanglePointChange(const long chart_ID=0, // chart's ID
const string name="Rectangle", // rectangle name
const int point_index=0, // anchor point index
datetime time=0, // anchor point time coordinate
double price=0) // anchor point price coordinate
{
//--- if point position is not set, move it to the current bar having Bid price
if(!time)
time=TimeCurrent();
if(!price)
price=SymbolInfoDouble(Symbol(),SYMBOL_BID);
//--- reset the error value
ResetLastError();
//--- move the anchor point
if(!ObjectMove(chart_ID,name,point_index,time,price))
{
Print(__FUNCTION__,
": failed to move the anchor point! Error code = ",GetLastError());
return(false);
}
//--- successful execution
return(true);
}
//+------------------------------------------------------------------+
//| Check the values of rectangle's anchor points and set default |
//| values for empty ones |
//+------------------------------------------------------------------+
void ChangeRectangleEmptyPoints(datetime &time1,double &price1,
datetime &time2,double &price2)
{
//--- if the first point's time is not set, it will be on the current bar
if(!time1)
time1=TimeCurrent();
//--- if the first point's price is not set, it will have Bid value
if(!price1)
price1=SymbolInfoDouble(Symbol(),SYMBOL_BID);
//--- if the second point's time is not set, it is located 9 bars left from the second one
if(!time2)
{
//--- array for receiving the open time of the last 10 bars
datetime temp[10];
CopyTime(Symbol(),Period(),time1,10,temp);
//--- set the second point 9 bars left from the first one
time2=temp[0];
}
//--- if the second point's price is not set, move it 300 points lower than the first one
if(!price2)
price2=price1-300*SymbolInfoDouble(Symbol(),SYMBOL_POINT);
}
//+------------------------------------------------------------------+
Sofern Sie nicht sparam weiter oben testen, wird dieser Code ausgelöst, wenn jede Objekt gezogen wird.
Mein ursprünglicher Code:
{
if(id==CHARTEVENT_OBJECT_DRAG && sparam=="line") // the chart event of dragging the line
{
// here was my functions
}
Das war keine Antwort an mich.
---
Aber ich benutze wie unten Code, die ich wenig ändern Sie Ihren Code für mich - und es funktioniert perfekt für mich, die ich will. Bis jetzt habe ich noch kein Problem gehabt.
Mache ich etwas falsch, bitte?
Ich wünsche Ihnen alles Gute.
Vielleicht hilft dies.
Fügen Sie dies zu einem Diagramm hinzu und Sie werden sehen:
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
ObjectCreate(0,"MyLine",OBJ_HLINE,0,0,Bid);
ObjectSetInteger(0,"MyLine",OBJPROP_SELECTED,true);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
ObjectDelete(0,"MyLine");
}
//+------------------------------------------------------------------+
//| OnChartEvent() |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
const long& lparam,
const double& dparam,
const string& sparam)
{
if(id==CHARTEVENT_OBJECT_DRAG && sparam=="MyLine")
{
double price=ObjectGetDouble(0,"MyLine",OBJPROP_PRICE,0);
Alert("MyLine moved! New price is " + DoubleToStr(price,_Digits));
}
}
//+------------------------------------------------------------------+
//| 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[])
{
return(rates_total);
}