This seems like the bane of all OrderSend errors. I can't seem to figure out why the Stop loss price is not calculating properly. I've tried multiplying it by 10 etc but it always gives the same error and printout.
Error: EURGBP,M1: Enter Price: 0.74660000 Stop Loss: 0.74705000 Take Profit: 0.74600000
sl and tp are passed by value integers of 45 and 60.
Error: EURGBP,M1: Enter Price: 0.74660000 Stop Loss: 0.74705000 Take Profit: 0.74600000
Inserted Code
void EnterTrade( double risk, int sl, int tp )
{
RefreshRates();
double SL, TP;
int dollarsAtRisk = AccountEquity() * Risk;
g_PositionSize = NormalizeDouble( (dollarsAtRisk / sl), 1 );
if( g_ConfirmLong == true )
{
SL = Ask - (sl * Point);
TP = Ask + (tp * Point);
g_TradeID = OrderSend( Symbol(), OP_BUY, g_PositionSize, Ask, Slippage, NormalizeDouble( SL, Digits ), NormalizeDouble( TP, Digits ), TradeComment, 0, 0, Green );
Print( "Enter Price: " + Ask + " Stop Loss: " + SL + " Take Profit: " + TP );
if( g_TradeID < 0 )
{
Print( "OrderSend failed with error#", GetLastError() );
ResetVars();
return(0);
}