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
Why do you normalize 10 digits? Use Digits everywhere.
Thanks - still get the error, though. My code looks like this now:
if (RegularorCandleCloseStoploss == True)
{
if (StealthMode == False)
{
CalcStopLossPips = StopLossSell;
}
else
{
CalcStopLossPips = EmergencyStopLoss;
}
}
else
{
StopLossLevel =NormalizeDouble(Low, Digits);
CalcStopLossPips = (MathAbs(Bid + StopLossLevel)) / pp;
}
if (UseTakeProfit) TakeProfitLevel = NormalizeDouble(Bid - TakeProfitSell * Point, Digits);
else TakeProfitLevel = 0.0;
Print("Sell Stoploss: ", DoubleToStr(StopLossLevel, Digits));
Print("TP: ", DoubleToStr(TakeProfitLevel, Digits));
Print("Bid: ", DoubleToStr(Bid, Digits));
Print("Digits: ", Digits);
OrderSend(Symbol(), OP_SELL, lotsForOrder, NormalizeDouble(Bid, Digits), Slippage, NormalizeDouble(Bid + (CalcStopLossPips * Point), Digits), NormalizeDouble(TakeProfitLevel, Digits), "Sell(#" + InternalMagicNumber + ")", InternalMagicNumber, 0, DeepPink);
Show me your experts logs, please.
What is pp?
I think you have a mistake when you calculate CalcStopLossPips.
pp is Point. The way the logic is working, though, this is getting executed:
CalcStopLossPips = StopLossSell;
OK, how much is StopLossSell?
It is set at 40.
Add
Print("SL: ", NormalizeDouble(Bid + (CalcStopLossPips * Point), Digits));
and show me your logs when you have an error.
2008.12.11 20:15:47 2008.09.17 00:00 FBMSoftwareEA USDJPY,H1: last error: 130
2008.12.11 20:15:47 2008.09.17 00:00 FBMSoftwareEA USDJPY,H1: Failed trade: OP_SELL USDJPY@105.63000000 tp@105.57000000 sl@105.66000000
2008.12.11 20:15:47 2008.09.17 00:00 FBMSoftwareEA USDJPY,H1: Failed to execute OP_SELL, after 0 retries
2008.12.11 20:15:47 2008.09.17 00:00 FBMSoftwareEA USDJPY,H1: Non-retryable error: 130
2008.12.11 20:15:47 2008.09.17 00:00 FBMSoftwareEA USDJPY,H1: OrderSend error 130
2008.12.11 20:15:47 2008.09.17 00:00 FBMSoftwareEA USDJPY,H1: About to attempt a OP_SELL 4.00000000 lots @105.63000000 sl:105.66000000 tp:105.57000000
2008.12.11 20:15:47 2008.09.17 00:00 FBMSoftwareEA USDJPY,H1: SL: 105.66
2008.12.11 20:15:47 2008.09.17 00:00 FBMSoftwareEA USDJPY,H1: Digits: 3
2008.12.11 20:15:47 2008.09.17 00:00 FBMSoftwareEA USDJPY,H1: Bid: 105.630
2008.12.11 20:15:47 2008.09.17 00:00 FBMSoftwareEA USDJPY,H1: TP: 105.570
2008.12.11 20:15:47 2008.09.17 00:00 FBMSoftwareEA USDJPY,H1: Sell Stoploss: 105.630
2008.12.11 20:15:47 2008.09.17 00:00 FBMSoftwareEA USDJPY,H1: Alert: SELL
I think you already understood your problem. You have Digits=3 and SL=40, it's too little. You have to set minimum SL(I don't no exactly your value) +Slippage.
You can check this value:
Print("Minimum SL - ",MarketInfo(Symbol(),MODE_STOPLEVEL));
Still doesn't make too much sense:
2008.12.12 21:11:03 2006.07.12 14:00 FBMSoftwareEA USDCAD,H1: OrderSend error 130
2008.12.12 21:11:03 2006.07.12 14:00 FBMSoftwareEA USDCAD,H1: About to attempt a OP_SELL 4.00000000 lots @1.13620000 sl:1.13680000 tp:1.13560000
2008.12.12 21:11:03 2006.07.12 14:00 FBMSoftwareEA USDCAD,H1: SL: 1.1368
2008.12.12 21:11:03 2006.07.12 14:00 FBMSoftwareEA USDCAD,H1: Minimum SL - 50
2008.12.12 21:11:03 2006.07.12 14:00 FBMSoftwareEA USDCAD,H1: Digits: 5
2008.12.12 21:11:03 2006.07.12 14:00 FBMSoftwareEA USDCAD,H1: Bid: 1.13620
2008.12.12 21:11:03 2006.07.12 14:00 FBMSoftwareEA USDCAD,H1: Stoploss Pips: 60
2008.12.12 21:11:03 2006.07.12 14:00 FBMSoftwareEA USDCAD,H1: TP: 1.13560
2008.12.12 21:11:03 2006.07.12 14:00 FBMSoftwareEA USDCAD,H1: Sell Stoploss: 1.13620
2008.12.12 21:11:03 2006.07.12 14:00 FBMSoftwareEA USDCAD,H1: Alert: SELL