[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 496

 

if(trendUP==true)

{

OrderSend(Symbol(),OP_BUY,Lot,Ask,3,Bid-200*Point,Bid+35*Point);

TP=OrderOpenPrice()+35*Point-Close[0];

}

if(trendDOWN==true)

{

OrderSend(Symbol(),OP_SELL,Lot,Bid,3,Ask+200*Point,Ask-35*Point);

TP=Close[0]-OrderOpenPrice()+35*Point;

}

OrderSelect(OrdersTotal()-1,SELECT_BY_POS);


if ((OrderType()==OP_BUY)&&(TP<3*Point))

{
OrderModify(OrderTicket(),0,Bid-4*Point,Bid+4*Point,0,Blue);
if (TP<Bid+4*Point)
{
TP=Bid+4*Point;
}
}

if ((OrderType()==OP_SELL)&&(TP<3*Point))
{
OrderModify(OrderTicket(),0,Ask+4*Point,Ask-4*Point,0,Blue);
if (TP>Ask-4*Point)
{
TP=Ask-4*Point;
}
}


help please with the code, the meaning is - when close gets closer to TP than 3 points, then appears "frame" of TP and SL of 4 points, you need to frame only rises, otherwise it makes no sense, but for some reason when the price falls frame follows the price, without a frame expert does not make a single losing trade, with a frame the expert goes to zero

 
LazarevDenis:


Please help me with the code - when close is close to TP closer than 3 points, then a "frame" of TP and SL of 4 points is formed; the frame should only go up, otherwise it makes no sense, but for some reason, when the price falls, the frame follows the price; without the frame, the EA does not make a single loss.

if ((OrderType()==OP_SELL)&&(TP<3*Point))

add another check that if the new SL of the buy order is higher and the sell order is lower than the current value

 
LazarevDenis:

It seems that mql4 does not have it, but mql5 does.

do not confuse MQL4 and MT4
 

Good afternoon.

This is the problem that pops up from time to time in the Experts tab. Checkmark "Allow to import DLL... ..." is checked.

15:30:02 DVD 100-50 cent EURUSD,M1: expert function calls are not allowed; 'stdlib'-'ErrorDescription'
15:30:02 DVD 100-50 cent EURUSD,M1: expert stopped

Roughly translated as - the function called by the Expert Advisor is not allowed.

 
kerakz:

Good afternoon.

This is the problem that pops up from time to time in the Experts tab. Checkmark "Allow to import DLL... ..." is checked.

15:30:02 DVD 100-50 cent EURUSD,M1: expert function calls are not allowed; 'stdlib'-'ErrorDescription'
15:30:02 DVD 100-50 cent EURUSD,M1: expert stopped

Roughly translated as - the function called by the Expert Advisor is not allowed.


and the checkbox to allow the import of external examiners?
 
LazarevDenis:

What about the checkbox to allow the import of external examiners?

It was checked the first time this error appeared. I removed it and since then it has been repeated 6-7 times for 3 months. 6-7 times since then.
 

Hello all!

There are two signals in the strategy: a primary and a secondary one. A trade is opened when the second signal appears no later than 12 hours later. Question: How can I teach my Expert Advisor not to react to the signal, if it appears later than 12 hours?

 
demlin:

Hello all!

There are two signals in the strategy: a primary and a secondary one. A trade is opened when the second signal appears no later than 12 hours later. Question: How can I teach my Expert Advisor not to react to the signal, if it appears later than 12 hours?


Save the time of the first signal and check the time difference when the second signal appears. Greater than the set time, reset the variables to zero and do nothing
 
Vinin:

Save the time of the first signal and check the time difference when the second signal arrives. More than the set time, reset the variables to zero and do nothing.
I understand the algorithm, the problem is what commands to implement it with. I haven't worked with time at all yet.
 
demlin:
I understand the algorithm, the problem is what commands to implement it with. I haven't worked with time at all yet.

There are different ways. Two words won't do the trick.