I also tried to use your script - it works as it should.
I only need it for other purposes. I attached it to my Expert Advisor.
i have indicators with horizontal lines - when the EA is triggered by a horizontal line - i want it to delete the indicator which is prescribed in the settings.
and did not remove the other indicators .
inputstring t8="------ ЛИНИЯ Open ------"; //inputstring InpHLineBUY = "S2_Line"; // HLine Name buyinputstring InpHLineSELL = "R2_Line"; // HLine Name sellinputbool InpReverse01 = false; // Reverse Open - переворот торгового сигналаinputbool UseDelete = true; // УДАЛЕНИЕ ИНДИКАТОРА Openinputstring short_name = "FiboPivot_V2"; // INDICATOR_SHORTNAMEinputstring t9="------ ЛИНИЯ Close ------"; //inputstring InpHLineCloseBUY = "S3_Line"; // HLine Name Close buyinputstring InpHLineCloseSELL = "R3_Line"; // HLine Name Close sellinputbool InpReverse10 = false; // Reverse Close - переворот торгового сигналаinputbool UseDelete1 = false; // УДАЛЕНИЕ ИНДИКАТОРА Closeinputstring short_name0 = "FiboPivot_V2"; // INDICATOR_SHORTNAMEinputbool Inpres = false; // Delete All Indicators//---
Торговая деятельность в платформе связана с формированием и отсылкой рыночных и отложенных ордеров для исполнения брокером, а также с управлением текущими позициями путем их модификации или закрытия. Платформа позволяет удобно просматривать торговую историю на счете, настраивать оповещения о событиях на рынке и многое другое. Открытие позиций...
when I opened ten positions in one direction - the line to close was triggered, nine closed, one left
------------
it was like this.
//+------------------------------------------------------------------+//| Check for long position closing |//+------------------------------------------------------------------+bool CSampleExpert::CheckForCloseBUY(void)
{
bool res=false;
for(int i=PositionsTotal()-1; i>=0; i--) // returns the number of current positionsif(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==MACD_MAGIC)
if(m_position.PositionType()==(long)POSITION_TYPE_SELL) // gets the position type
m_trade.PositionClose(m_position.Ticket()); // close a position by the specified symbol//---
res=true;
//--- resultreturn(res);
}
//+------------------------------------------------------------------+
Now it is like this
//+------------------------------------------------------------------+//| Check for long position closing |//+------------------------------------------------------------------+bool CSampleExpert::CheckForCloseBUY(void)
{
bool res=false;
for(int i=PositionsTotal()-1; i>=0; i--) // returns the number of current positionsif(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==MACD_MAGIC)
if(m_position.PositionType()==(long)POSITION_TYPE_SELL) // gets the position type
m_trade.PositionClose(m_position.Ticket()); // close a position by the specified symbolSleep(SLEEPTIME*1000);
for(int i=PositionsTotal()-1; i>=0; i--) // returns the number of current positionsif(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==MACD_MAGIC)
if(m_position.PositionType()==(long)POSITION_TYPE_SELL) // gets the position type
m_trade.PositionClose(m_position.Ticket()); // close a position by the specified symbol//---
res=true;
//--- resultreturn(res);
}
//+------------------------------------------------------------------+
script to delete an Indicator by INDICATOR_SHORTNAME
to spell indicator name correctly - copy as in the term
I've slapped it on - a manual trading assistant.
I tested it on a real account - everything that depends on it works.
script to delete an Indicator by INDICATOR_SHORTNAME
to spell an indicator's name correctly - copy it as in the thermal
The indicator deletesone by one from all charts, the desired ones can be skipped by pressing "cancel"
The indicator deletes one by one from all the charts, you can skip the desired ones by pressing "cancel".
I also tried to use your script - it works as it should.
I only need it for other purposes. I attached it to my Expert Advisor.
i have indicators with horizontal lines - when the EA is triggered by a horizontal line - i want it to delete the indicator which is prescribed in the settings.
and did not remove the other indicators .
I've slapped it on - a manual trading assistant.
Checked it on a real account - everything that depends on it works.
The function I added.
I thought it only worked with the horizontal line.
I don't know if it just depends on the object name.
chart from the tester
-----------------------------------------------------------------------
so stupid. it showed a result with 0.01
I fixed it a little bit here.
- The line was deleted before - and closed the position repeatedly. It closes then it doesn't.
But now - with this correction - it closes.
And yes! - this function is triggered by the name. either by a trend line, by a horizontal line or by the name of an object in general.
Also - to avoid confusion -
input string InpHLineBUY = "open buy"; // ВНИЗУ Name buy input string InpHLineSELL = "open sell"; // ВВЕРХУ Name sell input bool InpReverse01 = false; // Reverse Open - переворот торгового сигналаwhatever you write"open buy" it should always be at the bottom of the current price.
just switch reverse - then it will open sell
I fixed it a little bit here.
- The line was deleted before - and closed the position repeatedly. It closes then it doesn't.
But now - with this correction - it closes.
And yes - this function is triggered by the name. either by a trend line, by a horizontal line or by the name of the object in general.
There's still an error.
I corrected it to this, it works as it should.
I also changed it a bit.
when I opened ten positions in one direction - the line to close was triggered, nine closed, one left
------------
it was like this.
Now it is like this
with this function.
Oh, man - I figured it out.
I drew a trend line on the slant - it doesn't work and that's it
it turns out until the entire line from start to finish - the current price is not crossed. - does not work
the current price will cross itand it will not work.