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

 
<br / translate="no">

TarasBY:
First, sort out the terms: "EA script" is nonsense.
And in essence, you have little to answer for. Only able to poke your nose at spelling mistakes.
 
viktorlev:

And in essence you have little answer. You can only poke your nose in spelling mistakes.

The question was quite specific and has nothing to do with spelling - script or advisor?


If the code is too secret, read trading conditions of brokerage companies and check the values that cause errors (stops and volumes).

 
Counsellor!
 
viktorlev:
EA!

In any case, you don't have a check for not exceeding the allowable level of stop setting and check for correct lot volume

ZS. EA script == elbow

 
artmedia70:

In any case, you don't have a check to ensure that stops are not exceeded and that the lot volume is correct.

ZS. EA script == elbow



Not everyone is such a wolf in MQL terms.

And as for checking ........., it is 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. The Take Profit "tp" has to be fixed and not to move behind the price.



 
viktorlev:


Not everyone is such a wolf in terms of MQL.

And on the subject of checks ......... this is.

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. To make the take profit "tp" be fixed and not to move behind the price.

This is not a check. At least normalize it...

Why would you want to change TP in the trawl if you don't want to move it? Write OrderTakeProfit().

 
evillive:

This is not a test. At least normalise it or something...

And why would you put in a trawl to change the TP if you don't need to move it? Write OrderTakeProfit().



Thanks for the tip OrderTakeProfit()

Can I ask for a tutorial on OrderTakeProfit() (don't need one https://docs.mql4.com/ru/trading/ordertakeprofit))))

And please don't answer google to help. )))) With so many lessons, it's hard for an amateur to know which one is the best .........

 
viktorlev:


Thanks for the tip OrderTakeProfit()

Can I ask for a tutorial on OrderTakeProfit() (don't need one https://docs.mql4.com/ru/trading/ordertakeprofit))))

Please do not reply to google.)))) With so many tutorials it's hard for an amateur to decide which one is the best .........


Why Google? F1 in ME )))
 
evillive:

Why Google? F1 in ME )))

Funny ))))
 
viktorlev:

funny ))))

What's so funny? I learned from this reference, and still do, with examples from kodobase. no lessons, the only programming skills were Pascal Trubo and C Trubo, and those were in my first year at uni, fifteen years ago.
Reason: