[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 478
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
the link https://www.mql5.com/ru/code has a warehouse full of similar ones
you gave a link to a whole huge section )))
that's funny
Good afternoon!
I'm asking for help, I've already killed myself, I can't figure it out!!! I need, that at achievement +20 p., SL of the order was rearranged on the price of opening, i.e. function gives out 77
I cannot get it to work.
I need the SL of the order to be re-set to the opening price when it reaches +20 pips, i.e. the function shows 77
20 p is not calculated that way, you have to use the OrderOpenPrice() function and compare it with the current price, i.e., when the order reaches a positive or zero profit, you probably want the result to be 77, i.e:
the OrderProfit() function returns the order profit in the deposit currency, not in pips20p is not calculated this way, you have to use the OrderOpenPrice() function and compare it with the current price, apparently you want the result 77 to be returned when the order reaches a positive or zero profit, then it looks like this:
the OrderProfit() function returns the order profit in the deposit currency, not in pipsThat's about what I thought, I'm not calculating 20 p. They're set in the Bezub variable. I'm trying to compare the current order profit in the deposit currency (OrderProfit()) and the required level of 20 p in the deposit currency ((MarketInfo(Symbol (),MODE_TICKVALUE)*Bezub)
then you forgot to take into account the current price and how many pips the price has moved since the order was placed:
(OrderOpenPrice() -Bid)*MarketInfo(Symbol(),MODE_TICKVALUE)*Bezub
Please advise if I could get indicator data (the ones that allow it) from another indicator. I did not find such an opportunity in price types.
iCustom()
https://book.mql4.com/ru/samples/sharedthen you forgot to take into account the current price and how many pips the price has moved since the order was placed:
(OrderOpenPrice() -Bid)*MarketInfo(Symbol(),MODE_TICKVALUE)*Bezub
Tested your scheme. Alert generates for (OrderOpenPrice() -Bid)*MarketInfo(Symbol(),MODE_TICKVALUE)*Bezub values -0.033. Although there is 21p in the profit ! Is this normal?
Sorry, I'm writing without checking, I've got it wrong here, it should work like this:
Sell:(OrderOpenPrice()-Bid)*MarketInfo(Symbol(),MODE_TICKVALUE)*lot/Point
Buy: (Ask-OrderOpenPrice())*MarketInfo(Symbol(),MODE_TICKVALUE)*lot/Point
Sorry, I'm writing without checking, I've got it wrong here, it should work like this:
Sell:(OrderOpenPrice()-Bid)*MarketInfo(Symbol(),MODE_TICKVALUE)*lot/Point
Buy: (Ask-OrderOpenPrice())*MarketInfo(Symbol(),MODE_TICKVALUE)*lot/Point
Sorry, I'm writing without checking, I've got it wrong here, it should work like this:
Sell:(OrderOpenPrice()-Bid)*MarketInfo(Symbol(),MODE_TICKVALUE)*lot/Point
Buy: (Ask-OrderOpenPrice())*MarketInfo(Symbol(),MODE_TICKVALUE)*lot/Point