Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 519

 
tara:

I haven't heard of the right or the left.

So on your back or on your stomach!
 
borilunad:

On your back or on your stomach, then!
Sorry, I'm heterosexual.
 
viktorlev:


Not everyone is such a wolf in MQL terms.

And as for the checks ......... it's there.

if ((r2<30 && r1>30 && OrdersTotal()<1) || (OrderType()==OP_BUY && OrdersTotal()>=1 &&

OrdersTotal()<2 && Bid>OrderOpenPrice()+dif*Point))

OrderSend(Symbol(),OP_BUY,lot,Ask,0,Bid-sl*Point,Ask+tp*Point, "Easiest ever",0,0);

-----------------------------------------------------------------------------------------------

for (int i=0; i<OrdersTotal(); i++)

{

if (OrderSelect(i,SELECT_BY_POS,MODE_TIME)==true)

if (OrderType()==OP_BUY && Bid-ts*Point>OrderStopLoss()+5*Point)

OrderModify(OrderTicket(),OrderOpenPrice(),Bid-ts*Point,Ask+tp*Point 0,CLR_NONE);

----------------------------------------------------------------------------------------------

And since we are having a dialogue. There is one more QUESTION.

How to correctly spell the highlighted part (red) of the code. How to specify a Take Profit "tp" that is fixed and doesn't move behind the price.



Example of calculation of stop orders considering StopLevel requirements:

Global:

   int StopLoss   = 50; // Размер стопа в пунктах
   int TakeProfit = 50; // Размер тейка в пунктах

And in the EA code before sending the trade request:

   int level=(int)MarketInfo(Symbol(),MODE_STOPLEVEL);
   if(level==0) level=(int)MarketInfo(Symbol(),MODE_SPREAD)*2;
// ---- для позиции Buy расчёт стопа и тейка с учётом СтопЛевел:
   double sl=(StopLoss<=0)?0:NormalizeDouble(MathMin(Bid-StopLoss*Point,Bid-(level+1)*Point),Digits);
   double tp=(TakeProfit<=0)?0:NormalizeDouble(MathMax(Bid+TakeProfit*Point,Bid+(level+1)*Point),Digits);
// ---- для позиции Sell расчёт стопа и тейка с учётом СтопЛевел:
   double sl=(StopLoss<=0)?0:NormalizeDouble(MathMax(Ask+StopLoss*Point,Ask+(level+1)*Point),Digits);
   double tp=(TakeProfit<=0)?0:NormalizeDouble(MathMin(Ask-TakeProfit*Point,Ask-(level+1)*Point),Digits);
 
tara:
Sorry, I'm heterosexual.

You're welcome, even if you weren't! I didn't write homo, a that homo sapiens, I hope!
 
borilunad:

You're welcome, even if you weren't! I didn't write homo, a that homo sapiens, I hope!
Straightforward for sure.
 

Please advise how to make the "Window boundary reached" message appear when the indicator reaches its upper (lower) boundary. Thanks in advance.

Below is the indicator itself.

Files:
tr2.mq4  3 kb
 
oxotnik:

Please advise how to make the "Window boundary reached" message appear when the indicator reaches its upper (lower) boundary. Thanks in advance.

Below is the indicator itself.

The data is scalable. At one point in time the extremum will be 0.001 and that will be the maximum, at another point in time the extremum will be 0.02 and that will also be the maximum. So when do we decide that we have reached the maximum?
 
oxotnik:

Please advise how to make the "Window boundary reached" message appear when the indicator reaches its upper (lower) boundary. Thanks in advance.

Below is the indicator itself.


Yep, the window borders are the strongest support and resistance levels;)))))))))))))))))))))))
 
artmedia70:
The data is scalable. At one point in time, the extremum will be 0.001 and that will be the maximum, at another point in time, the extremum will be 0.02 and that will also be the maximum. So when do we decide that we have reached the maximum?


That's the problem, so that self-scaling is taken into account. That is, as you say, if the extremum is 0.001, the message will be displayed and, as soon as the extremum in the future changes to 0.002, the message should also be displayed.

VladislavVG This has nothing to do with it.

 
tara:
Straightforward for sure.


It's a good thing you don't bend! That's how you hold on!
Reason: