my backtest is still in progress, so I haven't had a chance to add the recommended script in. However, I had a search through the existing script in Metaeditor, and there is no mention of "swap" anywhere in the code... Does that mean that the EA does not take any kind of swap into consideration?
It certainly sounds that way. If you want to close an order at break even or better, then OrderProfit()+OrderCommission()+OrderSwap() >= 0
The swap is set by the broker like the commission, so ask(search) your broker about the swap().
honest_knave,
I see what you are saying. The code however does not have any mention of Commission nor Swap, and profit therefore should always be > 0.
while (currentOrderTicket == -1 && numberOfRetries < SEND_ORDER_PRICE_RETRIES )
{
if (stoploss < 0)
stoploss = 0;
if(cmd==OP_BUY)
{
price = Ask;
if (tp != 0)
tp = price + calcPriceDistance(takeProfit);
if(stoploss != 0)
stoploss = price - calcPriceDistance(stopLoss);
}
if(cmd==OP_SELL)
{
price = Bid;
if (tp != 0)
tp = price - calcPriceDistance(takeProfit);
if(stoploss != 0)
stoploss = price + calcPriceDistance(stopLoss);
}
Carl, my MetaTrader is not connected to any broker, hence I am not sure who I would ask... All I have done is to import data like this, and try and run my EA on it...
The tester uses its own data formate stored in ... .fxt-files like EURUSD60_0.fxt which is EURUSD and a 60-minute timeframe. Mt4 does not 'understand' data in ASCII-code.
Google for Tickstory - there you find a lot of explanation.
It could be - but I haven't checked it! - if you are not connected to a broker mt4 might be able to use the settings of the last connection.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi,
my backtest is still in progress, so I haven't had a chance to add the recommended script in. However, I had a search through the existing script in Metaeditor, and there is no mention of "swap" anywhere in the code... Does that mean that the EA does not take any kind of swap into consideration?
The swap is set by the broker like the commission, so ask(search) your broker about the swap().
The swap is set by the broker like the commission, so ask(search) your broker about the swap().
honest_knave,
I see what you are saying. The code however does not have any mention of Commission nor Swap, and profit therefore should always be > 0.
while (currentOrderTicket == -1 && numberOfRetries < SEND_ORDER_PRICE_RETRIES )
{
if (stoploss < 0)
stoploss = 0;
if(cmd==OP_BUY)
{
price = Ask;
if (tp != 0)
tp = price + calcPriceDistance(takeProfit);
if(stoploss != 0)
stoploss = price - calcPriceDistance(stopLoss);
}
if(cmd==OP_SELL)
{
price = Bid;
if (tp != 0)
tp = price - calcPriceDistance(takeProfit);
if(stoploss != 0)
stoploss = price + calcPriceDistance(stopLoss);
}
Carl, my MetaTrader is not connected to any broker, hence I am not sure who I would ask... All I have done is to import data like this, and try and run my EA on it...
<TICKER>,<DTYYYYMMDD>,<TIME>,<OPEN>,<HIGH>,<LOW>,<CLOSE>,<VOL>
GBPUSD,20010102,230100,1.5021,1.5021,1.5018,1.5018,4
GBPUSD,20010102,230200,1.5019,1.5019,1.5019,1.5019,4
GBPUSD,20010102,230300,1.5018,1.5019,1.5018,1.5019,4
GBPUSD,20010102,230400,1.5019,1.5019,1.5019,1.5019,4
The tester uses its own data formate stored in ... .fxt-files like EURUSD60_0.fxt which is EURUSD and a 60-minute timeframe. Mt4 does not 'understand' data in ASCII-code.
Google for Tickstory - there you find a lot of explanation.
It could be - but I haven't checked it! - if you are not connected to a broker mt4 might be able to use the settings of the last connection.