Hello Everyone. I am now on version 52. I have the trailing stop working on pairs such as the EURUSD where 1 pip = $1. I found out that with pairs such as the JPY, 1 pip = $0.93. I have tried evrything to correct for this, but I am unable to figure it out. I think I need to either multiply something with 1.11111 or 0.93 divide something with 1.11111 or 0.93. I simply want the EA to be accurate, i.e. that when I set the trailing stop to kick in at 10 pips, I want it to kick in at 10 pips and not at 9.3 pips. Can someone please shed some light on this please.
#property copyright"Kruger"// #property link "http://www.*****.com"// Kicks in when position reaches at least TrailingStop pips of profit.externstring LabelPips = "Value in Pips";
externdouble TrailingStart = 10;
externdouble TrailingStop = 5;
double res;
int init()
{
return(0);
}
int deinit()
{
return(0);
}
int start()
{
for (int i = 0; i < OrdersTotal(); i++)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)==true)
if (OrderSymbol()==Symbol() )
double pip = (MarketInfo(OrderSymbol(), MODE_POINT))*10;
if (OrderType() == OP_BUY)
{
if (Bid - OrderOpenPrice() > NormalizeDouble(TrailingStart *pip,4))
{
if (OrderStopLoss() < Bid - NormalizeDouble(TrailingStop * pip,4))
{
if (OrderModify(OrderTicket(), OrderOpenPrice(), Bid - NormalizeDouble(TrailingStop * pip,4), OrderTakeProfit(), Blue))
if(!res)
Print("Error setting Buy trailing stop: ",GetLastError());
elsePrint("Order modified successfully.");
}
}
}
elseif (OrderType() == OP_SELL)
{
if (OrderOpenPrice() - Ask > NormalizeDouble(TrailingStart * pip,4))
{
if ((OrderStopLoss() > Ask + NormalizeDouble(TrailingStop * pip,4)) || (OrderStopLoss() == 0))
{
if (OrderModify(OrderTicket(), OrderOpenPrice(), Ask + NormalizeDouble(TrailingStop * pip,4), OrderTakeProfit(), Red))
if(!res)
Print("Error setting Sell trailing stop: ",GetLastError());
elsePrint("Order modified successfully.");
}
}
}
}
return(0);
}
Hello Everyone. I am now on version 52. I have the trailing stop working on pairs such as the EURUSD where 1 pip = $1. I found out that with pairs such as the JPY, 1 pip = $0.93. I have tried evrything to correct for this, but I am unable to figure it out. I think I need to either multiply something with 1.11111 or 0.93 divide something with 1.11111 or 0.93. I simply want the EA to be accurate, i.e. that when I set the trailing stop to kick in at 10 pips, I want it to kick in at 10 pips and not at 9.3 pips. Can someone please shed some light on this please.