Thank you for your help. Can I also ask for an EA example (part of the code) of how to get the value from these lines in EA.
the function itself in Expert Advisor from Horizontal or Trend line
Here -(marked in yellow - here the name of line is set )\\\\\\\\\\\\ for 1 minute test - manually put a horizontal or trend line, set the same name in Expert Advisor and in the line itself.
//+------------------------------------------------------------------+//| TrendOpenedUp.mq5 |//| Copyright 2021, MetaQuotes Ltd. |//| https://www.mql5.com |//+------------------------------------------------------------------+#property copyright"Copyright 2021, MetaQuotes Ltd."#property link"https://www.mql5.com"#property version"1.00"//---sinputstring InpNameAverageUp = "Line Up"; // Line Name UP(Horizontal Line or Trend Line)sinputbool InpDelLineUp = false; // Delete (Horizontal Line or Trend Line)//---datetime ExtPrevBarsUp; // "0" -> D'1970.01.01 00:00';datetime ExtLastAverageUp; // "0" -> D'1970.01.01 00:00';//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+intOnInit()
{
//---//---return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+voidOnDeinit(constint reason)
{
//---
}
//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+voidOnTick()
{
//---
TrendOpenedUp();
}
//+------------------------------------------------------------------+//| Check for long position opening |//+------------------------------------------------------------------+bool TrendOpenedUp(void)
{
bool res=false;
datetime time_0=iTime(Symbol(),Period(),0);
if(time_0==ExtPrevBarsUp)
return(true);
ExtPrevBarsUp=time_0;
{
if(ObjectFind(0,InpNameAverageUp)<0)
return(true);
MqlRates ratesAverage[];
ArraySetAsSeries(ratesAverage,true);
int start_pos=0,count=3;
if(CopyRates(Symbol(),Period(),start_pos,count,ratesAverage)!=count)
return(false);
if(ratesAverage[0].time==ExtLastAverageUp)
return(true);
double price_line=0.0;
long object_type=ObjectGetInteger(0,InpNameAverageUp,OBJPROP_TYPE);
if(object_type==OBJ_HLINE)
price_line=ObjectGetDouble(0,InpNameAverageUp,OBJPROP_PRICE);
elseif(object_type==OBJ_TREND)
price_line=ObjectGetValueByTime(0,InpNameAverageUp,ratesAverage[1].time,0);
double value_by_time=price_line;
if(value_by_time==0.0)
return(true);
if(ratesAverage[1].open<value_by_time && ratesAverage[1].close>value_by_time)
{
PlaySound("request.wav");
if(InpDelLineUp)
ObjectsDeleteAll(0,InpNameAverageUp);
res=true;
}
if(ratesAverage[1].open>value_by_time && ratesAverage[1].close<value_by_time)
{
PlaySound("tick.wav");
if(InpDelLineUp)
ObjectsDeleteAll(0,InpNameAverageUp);
res=true;
}
}
//--- resultreturn(res);
}
//+------------------------------------------------------------------+
Hi all ! I'm begging for help, I've already racked my brain, I can't find how to implement the following. When opening a new bar, perform a calculation. When opening a new bar again, perform the calculation and perform any actions. I can't find it in MQL5 Please help!!!
m-r LSV: Hi all ! I'm begging for help, I've already racked my brain, I can't find how to implement the following. When opening a new bar, perform a calculation. When opening a new bar again, perform the calculation and perform any actions. I can't find it in MQL5 Please help!!!
If it is for an indicator, there is rates_total and prev_calculated. If it is for an EA, then the same as in mql4...
The opening of the candle is delayed by 9-12 seconds. Can you please tell me if this is the first tick?
It is just extremely important for me to make calculations, and perform any actions on the first tick of a new candle.
2021.06.0216:42:09.522 Test (Volatility 10 Index,M1) Новый бар
2021.06.0216:43:09.621 Test (Volatility 10 Index,M1) Новый бар
2021.06.0216:44:09.552 Test (Volatility 10 Index,M1) Новый бар
Thank you for your help. Can I also ask for an example of EA (part of the code) on how to get value from these lines in EA.
I made an Expert Advisor for myself https://www.mql5.com/ru/code/34046- which can perform operations on horizontal or trend lines
You need to know the name of horizontal lines fromTymen_STARC_Bands_MTF
here are their names
and enter them into the Expert Advisor and set the command
here
Thank you for your help. Can I also ask for an EA example (part of the code) of how to get the value from these lines in EA.
the function itself in Expert Advisor from Horizontal or Trend line
Here -(marked in yellow - here the name of line is set )\\\\\\\\\\\\ for 1 minute test - manually put a horizontal or trend line, set the same name in Expert Advisor and in the line itself.
Thank you for your help. Can I also ask for an EA example (part of the code) of how to get the value from these lines in EA.
the easiest and simplest way is to get the names of Horizontal or Trend lines from the Indicator.
- right-click on a chart and find LIST OF OBJECTS(copy and paste into Expert Advis or)
I'm begging for help, I've already racked my brain, I can't find how to implement the following.
When opening a new bar, perform a calculation.
When opening a new bar again, perform the calculation and perform any actions.
I can't find it in MQL5
Please help!!!
Hi all !
I'm begging for help, I've already racked my brain, I can't find how to implement the following.
When opening a new bar, perform a calculation.
When opening a new bar again, perform the calculation and perform any actions.
I can't find it in MQL5
Please help!!!
If it's for indicator, there are rates_total and prev_calculated. If it's for Expert Advisor, it's the same as in mql4...
Can I have a short piece of code please, I'm a newbie and my head is already boiling. Confused.
If it is for an indicator, there is rates_total and prev_calculated. If it is for an EA, then the same as in mql4...
Yes, it's for the indicator
Alexey Viktorov:
Если это для индикатора, то есть rates_total и prev_calculated. Если-же для советника, то так-же как и в mql4…
Am I reading this right?
The opening of the candle is delayed by 9-12 seconds.
Can you please tell me if this is the first tick?
It is just extremely important for me to make calculations, and perform any actions on the first tick of a new candle.
Am I reading this right?