Questions from Beginners MQL4 MT4 MetaTrader 4 - page 67

 
bablusut:

Good day to all good people ...

Below is the code of Trailing Stop function, who can explain the meaning ofOrderStopLoss()!=0 highlighted in the code, why it is applicable, in this case, only forOrderType()==1. ..?

...And another, more important question - how to write in this code the condition according to which only one of several open market orders meeting StopLoss requirements will be triggered? I.e., if we have two or more open orders of the same direction, only the order closest to the market price will be modified.

... thanks in advance to all who responded for any answer !!!


Let's take a piece of code and read it:

if(OrderType()==1 && TralPrice>=NormalizeDouble(OrderStopLoss(),Digits) && OrderStopLoss()!=0)return(0);

If StopLoss is zero, that is, it simply does not exist:TralPrice>=NormalizeDouble(OrderStopLoss(),Digits), in this case, the value ofTralPrice will always be greater, and it is incorrect to compare it to something, that is why we enteredOrderStopLoss()!=0 this says that if there is a StopLoss, then .

Now take apart the piece with bai and see why there is no check for stoploss.

 
Vitaly Muzichenko:

We take a piece of code and read it:

if(OrderType()==1 && TralPrice>=NormalizeDouble(OrderStopLoss(),Digits) && OrderStopLoss()!=0)return(0);

If StopLoss is zero, that is, it simply does not exist:TralPrice>=NormalizeDouble(OrderStopLoss(),Digits), in this case, the value ofTralPrice will always be higher, and it is incorrect to compare it with something, that is whyOrderStopLoss()!=0 is introduced, it says that if there is a StopLoss, then...

Now parse the bai piece and see why there is no check for stoploss.

Hello ... thanks for the reply ... "If stoploss is zero ... in that case the value ofTralPrice will always be greater" - let me disagree with you, it will not always be greater,TralPrice may be equal toStopLoss priceat the time of first placing ... but before that it will be higher, I agree.

...if(OrderType()==1&& TralPrice>=NormalizeDouble(OrderStopLoss(),Digits) &&OrderStopLoss()!=0)return(0); // this is a negation condition, prohibiting order modification, and composite ...

... ifTralPrice>OrderStopLoss(), orTralPrice=OrderStopLoss(), andOrderStopLoss()!=0,StopLoss already exists - thenreturn(0), no modification of the order ...

... and ifStopLossdoes not exist, it has not been set yet, then what ? then it turns out that even thoughTralPrice>OrderStopLoss() ... is that how it works ... or am I wrong ?

 
people, can you please tell me how to make the graphs in the terminal to save the markup after switching on again?
I saved in csv format, that didn't work
 
Sergey Parkin:
people, can you please tell me how to make the graphs in the terminal to save the markup after switching on again?
I saved in csv format, that didn't work
... and if you save it as a template, it won't work?
 
bablusut:
... and if you save it as a template, it doesn't work?
I guess not, templates are different.
comment no 666 :D
 
Sergey Parkin:
I don't think so, templates are different.
comment no 666 :D

save/load template, profile

try

 
Renat Akhtyamov:

save/load template, profile

try

Thanks, maybe a profile
 
99% simulation quality on the minute chart can be achieved?

Because on various forums they write that the new build shows n/a and it is not worth bothering
 

Such a question.

Is there an android version for tablets with mql4?

Or only for win on desktop computers?

 
Hi all!!! Guys, help me fix my mistakes!
Reason: