vx0532:
What does point have to do with profit in your account currency ? do you understand what OrderProfit() is ?
about below codes, it is very different when the red code "if(Pro<10000*Point)" is activated or not when I test it on the history data;
In the fact the history data is very simple, about consecutive 5 days, and Pro never exceeds 10000*Point.
when the red code is activated, the order stop line seems never move whatever.
it is very confusing.
RaptorUK:
What does point have to do with profit in your account currency ? do you understand what OrderProfit() is ?
What does point have to do with profit in your account currency ? do you understand what OrderProfit() is ?
haha,sorry,
OrderProfit() returns the current unrealized profit of the selected order.
I want to change stop loss line when the profit is more than some value, shall I?
vx0532: I want to change stop loss line when the profit is more than some value, shall I?
if(Pro<200*Point) Move_Stop=100; else /*if(Pro<10000*Point) */Move_Stop=200;
- on EURUSD Point is 0.0001 (4 digit broker) or 0.00001 (5) so 10000*Point is 10 or 1. So your first test is when profit < $0.2 or <$0.02 and the second test is profit < $1.00 or profit < $10.00
- If you don't execute the first (because profit is more than 0.2) AND you don't execute the second (because profit is more than $1) Then what is the value of Move_Stop?
- You want to "change when profit is more" so why are you testing for less?
- "shall you?" We don't know - have you learn to code?
- If your orderSelect fails, so does your code - What are Function return values ? How do I use them ? - MQL4 forum If the OrderModify fails don't you want to know why. If it's not working don't you want to know whether its the OrderModify or the fact it's not being called?
- If you change brokers (from 4 to 5 digits or back or put is on a JPY or metals chart) are you going to remember to change every number? In the right direction? Don't use Point, auto-adjust using pips2dbl
WHRoeder:
- on EURUSD Point is 0.0001 (4 digit broker) or 0.00001 (5) so 10000*Point is 10 or 1. So your first test is when profit < $0.2 or <$0.02 and the second test is profit < $1.00 or profit < $10.00
- my first test is profit <$0.2 or $0.02 and my second test is profit >$0.2&& <$10.0 or profit>$0.02 && <$1.0; in the other case (without if(Pro<10000*Point) ), just delete profit<$1.0 or <$10.0;
- If you don't execute the first (because profit is more than 0.2) AND you don't execute the second (because profit is more than $1) Then what is the value of Move_Stop?
- yes, Move_Stop=0, that is why error 130.
- You want to "change when profit is more" so why are you testing for less?
- testing less, because when less, Move_Stop will get "less" 's value just as "more".
- of course I have, that is why you see my post here.
- If your orderSelect fails, so does your code - What are Function return values ? How do I use them ? - MQL4 forum If the OrderModify fails don't you want to know why. If it's not working don't you want to know whether its the OrderModify or the fact it's not being called?
- thanks for your advice.
- If you change brokers (from 4 to 5 digits or back or put is on a JPY or metals chart) are you going to remember to change every number? In the right direction? Don't use Point, auto-adjust using pips2dbl
- thanks
thanks all
I have understand the situation.
vx0532:
Well done thanks all
I have understand the situation.

RaptorUK:
Well done
Well done
I modify them as below:
if(OrderSelect(i-1,SELECT_BY_POS)) { int Profit_Point=NormalizeDouble(OrderProfit()*Close[0]/100000/Point+50*Point,0); int Move_Stop=100; if(Profit_Point>0&&Profit_Point<=500) Move_Stop=400; if(Pro*Close[0]/100000>500*Point)Move_Stop=50; if(MathAbs(Close[0]-OrderStopLoss())>Move_Stop*Point) if(OrderType()==OP_BUY) {iWait();OrderModify(OrderTicket(),OrderOpenPrice(),Close[0]-Move_Stop*Point,0,0,0);} else if(OrderType()==OP_SELL) {iWait();OrderModify(OrderTicket(),OrderOpenPrice(),Close[0]+Move_Stop*Point,0,0,0);} }
OrderProfit()*Close[0]/100000/Point$n.nn profit * exchange rate / (1/Point) / Point = $n.nn profit * exchange rate = what? A meaningless value with meaningless units. What is the sound of the temperature of the sun - Huh?
WHRoeder:
$n.nn profit * exchange rate / (1/Point) / Point = $n.nn profit * exchange rate = what? A meaningless value with meaningless units. What is the sound of the temperature of the sun - Huh?
http://www.telegraph.co.uk/science/space/8114694/Stars-song-captured-by-scientists.html $n.nn profit * exchange rate / (1/Point) / Point = $n.nn profit * exchange rate = what? A meaningless value with meaningless units. What is the sound of the temperature of the sun - Huh?


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
about below codes, it is very different when the red code "if(Pro<10000*Point)" is activated or not when I test it on the history data;
In the fact the history data is very simple, about consecutive 5 days, and Pro never exceeds 10000*Point.
when the red code is activated, the order stop line seems never move whatever.
it is very confusing.