deVries:
what is this ??
you do ??
I did that . But still can't work. did i do wrongly?
for (int i = 0; i < OrdersTotal(); i++) //count down { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); //Calculate the point value in case there are extra digits in the quotes if (MarketInfo(OrderSymbol(), MODE_POINT) == 0.00001) PointValue = 0.0001; else if (MarketInfo(OrderSymbol(), MODE_POINT) == 0.0001) PointValue = 0.001; else if (MarketInfo(OrderSymbol(), MODE_POINT) == 0.001) PointValue = 0.01; else PointValue = MarketInfo(OrderSymbol(), MODE_POINT); //Normalize trailing stop value to the point value double TSTP = TrailingStop * PointValue;
normally we do
double MinLots,MaxLots,LotStep,StopLevel; //++++ These are adjusted for 5 digit brokers. int pips2points; // slippage 3 pips 3=points 30=points double pips2dbl; // Stoploss 15 pips 0.015 0.0150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- if(Digits % 2 == 1) // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262 {pips2dbl = Point*10; pips2points = 10; Digits.pips = 1;} else {pips2dbl = Point; pips2points = 1; Digits.pips = 0;} // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl //----
to get pips2dbl value
OrderDigit = (MarketInfo(OrderSymbol(), MODE_DIGITS); if ( OrderDigit % 2 == 1) {pips2dbl = Point*10;} else {pips2dbl = Point; }
for (int i = 0; i < OrdersTotal(); i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (MarketInfo(OrderSymbol(), MODE_POINT) == 0.00001) PointValue = 0.0001; : double TSTP = TrailingStop * PointValue; if (OrderType() == OP_BUY) { if (Bid - OrderOpenPrice() > TSTP)
- Always count down Loops and Closing or Deleting Orders - MQL4 forum
- What are Function return values ? How do I use them ? - MQL4 forum
- Since you are NOT filtering by magic number and/or pair you can only run it on one chart.
- Assume you are running on EURUSD and find an order on USDJPY. Bid = 1.33867 (current EURUSD rates) OrderOpenPrice = 98.60 (a USDJPY rates) and PointValue=0.01 (USDJPY pip value) Can this work?:
double TSTP = TrailingStop * PointValue; if (Bid - OrderOpenPrice() > TSTP)
double TSTP = 9 * 0.001; if (1.33867 - 98.60 > 0.009)
double TSTP = 9 * 0.001; if (-97.26133 > 0.009)
It still does not work.. As in I don't know how to fix it
If the selected order is not the current chart pair, you can not use any predefined variables.
WHRoeder:
If the selected order is not the current chart pair, you can not use any predefined variables.
If the selected order is not the current chart pair, you can not use any predefined variables.
I only run EUR/AUD at my mt4, the other pair are running at other mt4
You are selecting ALL orders - no filters
baokydev:
I only run EUR/AUD at my mt4, the other pair are running at other mt4
I only run EUR/AUD at my mt4, the other pair are running at other mt4
Why do you have this?
else if (MarketInfo(OrderSymbol(), MODE_POINT) == 0.0001) PointValue = 0.001;
This condition will be true for any symbol with 4 digits and the trailing stop will be your expected TS*10
Issue resolve. Thanks !

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
Below is my trail stop code, its work with JPY Pair which is like
1.33867 (EUR/USD) trail stop can work
98.60 (USD/JPY) trail stop can work
1.4137 - can't work
What is wrong with my code that EUR AUD cant work with trail stop
extern int TrailingStop=9; extern double StopLoss = 0;