Hi RaptorUK thanks for the reply
Not sure what the spread was at the time, the StopLoss was at 0
however I would think the spread was ok as it had just modifed an EURJPY order timed exactly the same
08:30:23 APairofPairsvY EURUSDm,M15: modify #101106284 sell 0.01 EURJPYm at 109.966 sl: 109.655 tp: 0.000 ok
and there is 0.125 gap between the Ask and SL request ....Ask = 124.858 SL = 124.733 the fact that it was a sell order would close that gap a bit ... but more than double the norm 6pips when EURJPY was fine
what do you think?
and there is 0.125 gap between the Ask and SL request ....Ask = 124.858 SL = 124.733 the fact that it was a sell order would close that gap a bit ... but more than double the norm 6pips when EURJPY was fine
what do you think?
- RaptorUK:
For Buy order the SL is taken at Bid price . . . what is your MarketInfo MODE_STOPLEVEL ? your SL is only 12.5 pips away, looks like it's too close . .Even closer than 12.5 since for a buy, stops are relative to the BID
- and there is 0.125 gap between the Ask and SL request ....Ask = 124.858 SL = 124.733 the fact that it was a sell order would close that gap a bit ... but more than double the norm 6pips when EURJPY was fineIf this is a sell order then the SL must be ABOVE the market ASK
- EA/s must adjust for 4/5 digit brokers, your multiply by MODE_POINT doesn't.
1. Sorry to have confused you, the EURJPY trade that worked fine was a Sell and the GBPJPY was a Buy trade. So the ASK = 124.858 and SL = 124.733 is a 12.5 pip gap (over double the normal spread).
2. Its a Buy trade and the SL is below the Ask price so that is ok.
3. JPY is neither 4 or 5 digits .... it is 3 Digits and the MODE_POINT works fine for JPY ..... MarketInfo("GBPJPYm",MODE_POINT) * 125 = 12.5 pips
I think it may still be a spread problem but it seems strange that the EURJPY worked fine at the same time. However, the gap on the EURJPY was also 12.5 pips which is approximately 3 x the normal spread.
So maybe if I try setting JPYBE to say 62 and add the spread......Like so
Result = OrderModify(SecondJPYTicket, SecondJPYOpen, MarketInfo("GBPJPYm",MODE_ASK) - MarketInfo("GBPJPYm", MODE_POINT) * JPYBE + MarketInfo("GBPJPYm",MODE_SPREAD), 0, 0, Blue);
This will work?
What are te thoughts on that please
3. JPY is neither 4 or 5 digits .... it is 3 Digits and the MODE_POINT works fine for JPY ..... MarketInfo("GBPJPYm",MODE_POINT) * 125 = 12.5 pips
I think it may still be a spread problem but it seems strange that the EURJPY worked fine at the same time. However, the gap on the EURJPY was also 12.5 pips which is approximately 3 x the normal spread.
So maybe if I try setting JPYBE to say 62 and add the spread......Like so
Result = OrderModify(SecondJPYTicket, SecondJPYOpen, MarketInfo("GBPJPYm",MODE_ASK) - MarketInfo("GBPJPYm", MODE_POINT) * JPYBE + MarketInfo("GBPJPYm",MODE_SPREAD), 0, 0, Blue);
This will work?
What are te thoughts on that please
Regarding 3., the point is that if you run your EA on a "4 digit Broker" your 125 SL will become 125 pips.
Spread for EJ will be less than the spread for GJ.
Result = OrderModify(SecondJPYTicket, SecondJPYOpen, MarketInfo("GBPJPYm",MODE_ASK) - ... if (Result < 1)
OrderModify returns a bool not an int. if(!OrderModify(...){ Alert(...- No it has to be below the Bid by at least MarketInfo("GBPJPYm", MODE_STOPLEVEL)*Point
. Its a Buy trade and the SL is below the Ask price so that is ok.
- 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 already have in my code 2 attempts at modifying stop losses (running on EURUSDm chart as using multiple pairs) . Can anybody tell me why/how I got this error and how to avoid it in the future
Code snippet: where JPYBE = 125
if (TradeBusy() < 0)
{
Print(Symbol(), " Trade is still busy");
return(0);
}
RefreshRates();
Result = OrderModify(SecondJPYTicket, SecondJPYOpen, MarketInfo("GBPJPYm",MODE_ASK) - MarketInfo("GBPJPYm", MODE_POINT) * JPYBE, 0, 0, Blue);
if (Result < 1)
{
Print("Error ", GetLastError(), " On First Attempt to Modify StopLoss On",OrderSymbol());
RefreshRates();
Result = OrderModify(SecondJPYTicket, SecondJPYOpen, MarketInfo("GBPJPYm",MODE_ASK) - MarketInfo("GBPJPYm", MODE_POINT) * JPYBE, 0, 0, Blue);
if (Result <1)
{
Print("Error ", GetLastError(), " While Modifying StopLoss On GBPJPYm");
Print("SecondJPYTicket ", SecondJPYTicket, " SecondJPYOpen ", SecondJPYOpen);
Print(" Ask = ", MarketInfo("GBPJPYm", MODE_ASK), " SL = ", MarketInfo("GBPJPYm", MODE_ASK) - MarketInfo("GBPJPYm",MODE_POINT)* JPYBE);
}
}
TradeNotBusy();
Error messages:
08:30:23 APairofPairsvY EURUSDm,M15: Error 130 On First Attempt to Modify StopLoss On GBPJPYm
08:30:23 APairofPairsvY EURUSDm,M15: Error 130 While Modifying StopLoss On GBPJPYm
08:30:23 APairofPairsvY EURUSDm,M15: SecondJPYTicket 101106283 SecondJPYOpen 124.926
08:30:23 APairofPairsvY EURUSDm,M15: Ask = 124.858 SL = 124.733
08:30:23 APairofPairsvY EURUSDm,M15: TradeNotBusy