Modify = OrderModify(Ticket,OrderOpenPrice(),0,NewProfit,0); Tt = GetLastError(); if (Tt > 0)
Do not look at last error until you get an error (Modify == false)NewProfit = (Ask-0.00005);
What is MarketInfo(market_pair, MODE_STOPLEVEL)? You can't move SL/TP closer to market than that. 5 Points?
My problem is within the remodification of the orders. It seems as though OrderType is ignored. The code was not to remodify on a negative profit either. See my log results below:
11:40:00 Custom Test M83 USDCHF,M5: open #42911948 buy 0.10 USDCHF at 0.93883 ok
614668 12:24:21 Custom Test M83 USDCHF,M5: Alert: Attempt to Initial Modifiy BUY 42911948. Awaiting response..
614675 12:24:21 Custom Test M83 USDCHF,M5: modify #42911948 buy 0.10 USDCHF at 0.93883 sl: 0.00000 tp: 0.93915 ok
614676 12:24:21 Custom Test M83 USDCHF,M5: Alert: BUY Order Initial Modified # 42911948 Bid = 0.93892 PastBid = 0.93883 UP OOP = 0.93883 TP: 0.93915 Profit = 1.28 B = 1 0
614678 12:24:21 Custom Test M83 USDCHF,M5: Alert: BUY Order ReModified # 42911948 Bid = 0.93892 PastBid = 0.93883 UP OOP = 0.93883 TP: 0.93897 Profit = 1.28 B = 1 0
614697 12:24:21 Custom Test M83 USDCHF,M5: Alert: Attempt to ReModifiy 42911948. Awaiting response..
614698 12:24:21 Custom Test M83 USDCHF,M5: modify #42911948 buy 0.10 USDCHF at 0.93883 sl: 0.00000 tp: 0.93899 ok
614699 12:24:22 Custom Test M83 USDCHF,M5: Alert: SELL Order ReModified # 42911948 Ask = 0.93904 PastAsk = 0.93894 UP OOP = 0.93883 TP: 0.93899 Profit = 0.96 S = 0 0
614724 12:24:22 Custom Test M83 USDCHF,M5: Alert: Attempt to ReModifiy 42911948. Awaiting response..
614725 12:24:22 Custom Test M83 USDCHF,M5: modify #42911948 buy 0.10 USDCHF at 0.93883 sl: 0.00000 tp: 0.93897 ok
614726 12:24:22 Custom Test M83 USDCHF,M5: Alert: SELL Order ReModified # 42911948 Ask = 0.93902 PastAsk = 0.93904 DOWN OOP = 0.93883 TP: 0.93897 Profit = 0.53 S = 0 0
614803 12:24:22 Custom Test M83 USDCHF,M5: Alert: Attempt to ReModifiy 42911948. Awaiting response..
614805 12:24:22 Custom Test M83 USDCHF,M5: modify #42911948 buy 0.10 USDCHF at 0.93883 sl: 0.00000 tp: 0.93896 ok
614806 12:24:23 Custom Test M83 USDCHF,M5: Alert: SELL Order ReModified # 42911948 Ask = 0.93901 PastAsk = 0.93903 DOWN OOP = 0.93883 TP: 0.93896 Profit = 0.53 S = 0 0
614825 12:24:23 Custom Test M83 USDCHF,M5: Alert: Attempt to ReModifiy 42911948. Awaiting response..
614832 12:24:23 Custom Test M83 USDCHF,M5: modify #42911948 buy 0.10 USDCHF at 0.93883 sl: 0.00000 tp: 0.93894 ok
614833 12:24:23 Custom Test M83 USDCHF,M5: Alert: SELL Order ReModified # 42911948 Ask = 0.93899 PastAsk = 0.93903 DOWN OOP = 0.93883 TP: 0.93894 Profit = 0.32 S = 0 0
614881 12:24:23 Custom Test M83 USDCHF,M5: Alert: Attempt to ReModifiy 42911948. Awaiting response..
614882 12:24:23 Custom Test M83 USDCHF,M5: modify #42911948 buy 0.10 USDCHF at 0.93883 sl: 0.00000 tp: 0.93892 ok
614883 12:24:23 Custom Test M83 USDCHF,M5: Alert: SELL Order ReModified # 42911948 Ask = 0.93894 PastAsk = 0.93903 DOWN OOP = 0.93883 TP: 0.93892 Profit = 0 S = 0 0
614902 12:24:23 Custom Test M83 USDCHF,M5: Alert: Attempt to ReModifiy 42911948. Awaiting response..
614903 12:24:23 Custom Test M83 USDCHF,M5: modify #42911948 buy 0.10 USDCHF at 0.93883 sl: 0.00000 tp: 0.93889 ok
614904 12:24:24 Custom Test M83 USDCHF,M5: Alert: SELL Order ReModified # 42911948 Ask = 0.93894 PastAsk = 0.93897 DOWN OOP = 0.93883 TP: 0.93889 Profit = -0.32 S = 0 0
614952 12:24:24 Custom Test M83 USDCHF,M5: Alert: Attempt to ReModifiy 42911948. Awaiting response..
614953 12:24:24 Custom Test M83 USDCHF,M5: modify #42911948 buy 0.10 USDCHF at 0.93883 sl: 0.00000 tp: 0.93888 ok
614954 12:24:24 Custom Test M83 USDCHF,M5: Alert: SELL Order ReModified # 42911948 Ask = 0.93885 PastAsk = 0.93897 DOWN OOP = 0.93883 TP: 0.93888 Profit = -0.43 S = 0 0
615002 12:24:24 Custom Test M83 USDCHF,M5: Alert: Attempt to ReModifiy 42911948. Awaiting response..
615003 12:24:24 Custom Test M83 USDCHF,M5: modify #42911948 buy 0.10 USDCHF at 0.93883 sl: 0.00000 tp: 0.93887 ok
615004 12:24:25 Custom Test M83 USDCHF,M5: Alert: SELL Order ReModified # 42911948 Ask = 0.93894 PastAsk = 0.93897 DOWN OOP = 0.93883 TP: 0.93887 Profit = -0.53 S = 0 0

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm trying to modify buy and sell orders, but having a problem. When I'm trying to modify a buy, my code is modifying the buy, not only by the code that I have for modifying buys, but also by the code that I have for modifying a sell. Which causes my TP to decrease rather than to increase. Not sure of what the problem is. Any help would be greatly appreciated!
Thanks!