I notice some unexpected entry execution prices when comparing 4 limit price variations for a long entry.
With a default slippage (so basically, no use of this setting), the following 2 entries:
Trade = enterLong(1, priceLow());
Trade = enterLong(1, priceLow() - 0.0001)
(note that I disable one of them per test run)
return:
Execution Price for EUR/USD: 1.12098
Execution Price for USD/JPY: 108.72152
Execution Price for GBP/USD: 1.32219
Execution Price for AUD/USD: 0.70026
Execution Price for USD/CAD: 1.29863
and the following 2 entries:
Trade = enterLong(1, priceHigh());
Trade = enterLong(1, priceHigh() + 0.0001);
(note that I disable one of them per test run)
return:
Execution Price for EUR/USD: 1.12090
Execution Price for USD/JPY: 108.71700
Execution Price for GBP/USD: 1.32201
Execution Price for AUD/USD: 0.70016
Execution Price for USD/CAD: 1.29851
Why is there no difference in execution price between these 2 variations? (i.e. both priceLow() variations and vice versa for priceHigh())
Why are the last 2 variations (i.e. priceHigh()...) executed at a lower price, compared to the 2 priceLow() variations? For a long entry this makes no sense to me.
When I adjust slippage to 0, all 4 limit variations return the same entry execution price. This also makes no sense to me.
Here's my full code
TRADE* Trade;
var Time;
function run()
{
History = ".t6";
BarPeriod = 1;
StartDate = 20200101;
LookBack = 0;
EntryTime = 1440;
Slippage = 0;
set(LOGFILE);
if(is(INITRUN))
{
asset("EUR/USD");
asset("USD/JPY");
asset("GBP/USD");
asset("AUD/USD");
asset("USD/CAD");
}
if(Bar < 1)
{
return 0;
}
if(Bar >= 1)
{
while(asset(loop("EUR/USD", "USD/JPY", "GBP/USD", "AUD/USD", "USD/CAD")))
{
Time = timer();
//***Both pointers return the same execution price and are higher than the priceHigh() limits when slippage = default.***
//printf("\npriceLow(): %.5f", priceLow());
//Trade = enterLong(1, priceLow());
//Trade = enterLong(1, priceLow() - 0.0001);
//***Both pointers return the same execution price and are lower than the priceLow() limits when slippage = default.***
//printf("\npriceHigh(): %.5f", priceHigh());
//Trade = enterLong(1, priceHigh());
Trade = enterLong(1, priceHigh() + 0.0001);
ThisTrade = Trade;
Time = timer();
for(last_trades)
{
if(TradeIsPending)
{
if(timer() - Time >= 1000)
{
printf("\n%s: Pending Order", Asset);
Time = timer();
}
}
printf("\nExecution Price for %s: %.5f", Asset, TradePriceOpen);
}
}
quit();
}
}