Please give me a hint, because I have never asked for help from a programmer before - page 6

 
Serqey Nikitin:

You don't get it... No one is going to FIX the quotes...

There is no prohibition in the rules against "delays" in order execution... and spread widening...

I see your point. You probably misunderstood me. What I meant was that there are limits to everything. The spread will not widen 10 times for every open order. The delay will not be increased by several times.

And to be honest, I didn't come here to brag. If the idea doesn't work, I'll be in the majority, that's the norm.
 
Serqey Nikitin:

You don't get it... No one is going to FIX the quotes...

There is no prohibition in the rules against "delays" in order execution... and spread widening...

I'm sorry you wasted so much time on a useless idea..., and only because you fell for the scalping ads...
 
Serqey Nikitin:
I'm sorry you wasted so much time on a useless idea..., and only because you fell for scalping ads...

That is the end of our dialogue with you. I don't want to pry and dig into other people's speculations.

 
Aleksandr2233:

That is the end of our dialogue with you. I don't want to pry and dig into other people's speculations.

Use your head... sometimes it helps if you don't get the right advice...
 

The Expert Advisor sets Stop Loss and Take Profit to pending orders, if there are none. And deletes the pending orders if the distance from the pending order to the price exceeds the distance from the pending order to the stop.

#property version   "2.00"
#property strict

input int StopLoss=300;
input int TakeProfit=500;

double loss, profit;
bool result;

string symbol;
double point;
int digits;
 
MqlTick tick;


int OnInit()
   {
   symbol=Symbol();
   point=SymbolInfoDouble(symbol,SYMBOL_POINT);
   digits=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
   return(INIT_SUCCEEDED);
   }

void OnDeinit(const int reason)
   {
   
   }

void OnTick()
   {
   SymbolInfoTick(symbol,tick);
   for(int i=OrdersTotal()-1; i>=0; i--)
      {
      if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && OrderSymbol()!=symbol && OrderClosePrice()!=0) continue;
      if(OrderType()==OP_BUYLIMIT || OrderType()==OP_SELLSTOP)
         {
         //устанавливаем стоплосс и тейкпрофит
         if((OrderStopLoss()==0 && StopLoss>0) || (OrderTakeProfit()==0 && TakeProfit>0))
            {
            loss=(StopLoss>0)?NormalizeDouble(tick.ask-MathMax(StopLoss,(int)SymbolInfoInteger(symbol,SYMBOL_TRADE_STOPS_LEVEL))*point,digits):0;
            profit=(TakeProfit>0)?NormalizeDouble(MathMax(TakeProfit,(int)SymbolInfoInteger(symbol,SYMBOL_TRADE_STOPS_LEVEL))*point-tick.bid,digits):0;
            result=OrderModify(OrderTicket(),OrderOpenPrice(),loss,profit,0);
            }
         //удаляем ордер
         if(OrderStopLoss()>0 && tick.ask-OrderOpenPrice()>OrderOpenPrice()-OrderStopLoss())
            {
            result=OrderDelete(OrderTicket());
            }            
         }
      if(OrderType()==OP_SELLLIMIT || OrderType()==OP_BUYSTOP)
         {
         //устанавливаем стоплосс и тейкпрофит
         if((OrderStopLoss()==0 && StopLoss>0) || (OrderTakeProfit()==0 && TakeProfit>0))
            {
            loss=(StopLoss>0)?NormalizeDouble(MathMax(StopLoss,(int)SymbolInfoInteger(symbol,SYMBOL_TRADE_STOPS_LEVEL))*point-tick.bid,digits):0;
            profit=(TakeProfit>0)?NormalizeDouble(tick.ask-MathMax(TakeProfit,(int)SymbolInfoInteger(symbol,SYMBOL_TRADE_STOPS_LEVEL))*point,digits):0;
            result=OrderModify(OrderTicket(),OrderOpenPrice(),loss,profit,0);
            }
         //удаляем ордер
         if(OrderStopLoss()>0 && OrderOpenPrice()-tick.bid>OrderStopLoss()-OrderOpenPrice())
            {
            result=OrderDelete(OrderTicket());
            }            
         }
      }
   }

did not test

 
Aleksei Stepanenko:

The Expert Advisor sets Stop Loss and Take Profit to pending orders, if there are none. And deletes the pending orders if the distance from the pending order to the price exceeds the distance from the pending order to the stop.

have not tested

I will check it later. Thank you. More likely to reply to you in a private message.

 
Serqey Nikitin:
Turn your head on..., sometimes it helps if you don't get the right advice...

Thank you for the advice.

 
Aleksei Stepanenko:

The Expert Advisor sets Stop Loss and Take Profit to pending orders, if there are none. And deletes the pending orders if the distance from the pending order to the price exceeds the distance from the pending order to the stop.

have not tested

However, I do not know what to do with the code to get a ready-made ex4 file. I know there is a program MetaEditor, but I have only opened it once.

 
put it in the \MQL4\Indicators folder and restart the terminal
Files:
 
Aleksei Stepanenko:
put it in the \MQL4\Indicators folder and restart the terminal

and the file I understand is an expert

A snapshot of the ee