hola amigos, soy nuevo en la programacion, y e estado intentando obtener valor de un objeto grafico, para generar condiciones para señales, e intentado obtener valores de los objetos pero no e sido capaz de poner la condicion de cuando toque el objeto genere una flecha si alguien mas experto en el tema me puede orientar le agradeceria mucho ahy dejo mi codigo gracias buen dia
string SR;
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit()
{
IndicatorBuffers(2);
SetIndexBuffer(0, Buffer1);
PlotIndexSetInteger(0, PLOT_ARROW,234);
SetIndexArrow(0, 234);
SetIndexBuffer(1, Buffer2);
PlotIndexSetInteger(1, PLOT_ARROW,233);
SetIndexArrow(1, 233);
//initialize myPoint
SR = "nombre de objeto";
ChartSetInteger(0, CHART_EVENT_OBJECT_DELETE, true);
ChartSetInteger(0, CHART_EVENT_OBJECT_CREATE, true);
myPoint = Point();
if(Digits() == 5 || Digits() == 3)
{
myPoint *= 10;
}
return(INIT_SUCCEEDED);
}
voidOnDeinit(constint reason) {
}
voidOnTick() {
}
voidOnChartEvent(constint id,
constlong &lparam,
constdouble &dparam,
conststring &sparam) {
// For the first situation I know a new arrow is created for a signal// Only react on new arrow// Only on object_createif (id==CHARTEVENT_OBJECT_CREATE) {
NewObject(sparam);
return;
}
}
void NewObject(string name) {
// Only on name matching test_arrow_*if (StringSubstr(name, 0, StringLen(SR))!=SR) return;
// Quick check that the object exists in the correct window// I'm looking at window 0int sub_window = ObjectFind(0, name);
if (sub_window!=0) return;
// Only buy arrows or sell arrowslong type = ObjectGetInteger(0, name, OBJPROP_TYPE);
if (type!=OBJ_HLINE && type!=OBJ_TREND) return;
// Report the object found
ReportObject("New", name);
}
void ReportObject(string event, string name) {
// Now I have an object, grab some properties but what you do depends on the strategydatetime object_time = (datetime)ObjectGetInteger(0, name, OBJPROP_TIME);
ENUM_OBJECT object_type = (ENUM_OBJECT)ObjectGetInteger(0, name, OBJPROP_TYPE);
int object_bar = iBarShift(Symbol(), Period(), object_time);
double object_price = ObjectGetDouble(0, name, OBJPROP_PRICE);
double bar_high = iHigh(Symbol(), Period(), object_bar);
double bar_low = iLow(Symbol(), Period(), object_bar);
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime& time[],
constdouble& open[],
constdouble& high[],
constdouble& low[],
constdouble& close[],
constlong& tick_volume[],
constlong& volume[],
constint& spread[])
{
int limit = 1000;
//--- counting from 0 to rates_totalArraySetAsSeries(Buffer1, true);
ArraySetAsSeries(Buffer2, true);
//--- initial zeroif(prev_calculated < 1)
{
ArrayInitialize(Buffer1, 0);
ArrayInitialize(Buffer2, 0);
}
else
limit++;
//--- main loopfor(int i = 500; i >= 0; i--)
{
testnew(i);
}
return(rates_total);
}
//+------------------------------------------------------------------+void testnew(int i )
{
double SRf1 = ObjectGetDouble(0,SR,OBJPROP_PRICE);
double SRf2 = ObjectGetDouble(0,SR,OBJPROP_PRICE2);
if//lts
(
High[i]<=SRf1 && High[i+1] >SRf1
)
{
Buffer1[0+i] = High[0+i]+10*Point;
}
else
{
Buffer1[0+i] = 0;
}
if
(
Low[i]>=SRf2 && Low[i+1]< SRf2
)
{
Buffer2[0+i] = Low[0+i]-10*Point;
}
else
{
Buffer2[0+i] = 0;
}
}
PlotIndexSetInteger - Indicadores personalizados - Manual de referencia de MQL5 - manual de usuario para el lenguaje del trading algorítmico/automático para MetaTrader 5
Para iniciar sesión y usar el sitio web MQL5.com es necesario permitir el uso de Сookies.
Por favor, active este ajuste en su navegador, de lo contrario, no podrá iniciar sesión.
Ha iniciado sesión. La autenticación de dos factores se ha desactivado. Vuelva a configurarla y escanee un nuevo código QR, o continúe con la autenticación de dos factores desactivada.
hola amigos, soy nuevo en la programacion, y e estado intentando obtener valor de un objeto grafico, para generar condiciones para señales, e intentado obtener valores de los objetos pero no e sido capaz de poner la condicion de cuando toque el objeto genere una flecha si alguien mas experto en el tema me puede orientar le agradeceria mucho ahy dejo mi codigo gracias buen dia