for (int j = 0; j < OrdersTotal(); j++) { OrderSelect (j, SELECT_BY_POS, MODE_TRADES); if (MarketInfo(OrderSymbol(), MODE_POINT) == 0.00001) { PointValue = 0.0001; } else if (MarketInfo(OrderSymbol(), MODE_POINT) == 0.001) { PointValue = 0.01; } else { PointValue = MarketInfo (OrderSymbol(), MODE_POINT); } double LastThreeLowest = iLowest (Symbol(), 0, MODE_LOW, 3, 0); double LastThreeHighest = iHighest (Symbol(), 0, MODE_HIGH, 3, 0);
What Symbol() has the trade you try to modify are you sure it is same as chart your trailingstop is attached...
MagicNumber not important ???
Stoplevel ???
Freezelevel ???
and not checking why modify trade fails
Read again because it is told you before : What are Function return values ? How do I use them ?
You are identifying the Bar shift with the highest and lowest, but not the value
double LastThreeLowest = iLowest (Symbol(), 0, MODE_LOW, 3, 0); double LastThreeHighest = iHighest (Symbol(), 0, MODE_HIGH, 3, 0);
GumRai:
You are identifying the Bar shift with the highest and lowest, but not the value
You are identifying the Bar shift with the highest and lowest, but not the value
Ah thanks for clarifiing. I was under the impression, that iLowest and iHighest already gave me a value. Therefor I added
double LowestValue = iLow (Symbol(), 0, LastThreeLowest); double HighestValue = iHigh (Symbol(), 0, LastThreeHighest);
and now it seems to work as intended.
Thanks to everybody for their time. Much appreciated.
double LowestValue = iLow (Symbol(), 0, LastThreeLowest); double HighestValue = iHigh (Symbol(), 0, LastThreeHighest);
You should use OrderSymbol() or filter the trades where OrderSymbol()==Symbol().
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
Hi there,
i recently restarted programming MQL4 and made myself a Trailing Stop EA. Sadly the following version, which shall "trail" the Stop Loss depending on the Highs and Lows of the 3 most recent closed candles does absolutely nothing when activated: