User
Joined: Jul 2017
Posts: 785
|
Zorro 'peeks' by one 'tick' when entering trades by returning 2 in a tmf. This script: [size:8pt]function stp(var entStp) {
print(TO_LOG,"\n in tmf: %s, high = %.5f, close = %.5f", strdate(HMS,wdate(0) ), priceHigh(0), priceClose(0) );
if (TradeIsPending)
{
if (TradeIsLong)
if (priceHigh(0)>priceOpen(0)+entStp ) // or priceClose(0)>
{
print(TO_LOG,"\n ---- long Entry Stop is hit!----open=%.5f, high=%.5f close=%.5f entStp=%.5f", priceOpen(0), priceHigh(0), priceClose(0), priceOpen(0)+entStp);
return 2;
}
}
return 4;
}
function run()
{
set(LOGFILE, TICKS);
Verbose = 3;
Spread=Slippage = 0;
BarPeriod = 60;
StartDate = 2019; //2015
EndDate = 2020;//0424;
asset("EUR/USD");
var atr = ATR(24);
LifeTime=1;
Entry = 1.5*atr;
enterLong(stp,0.5*atr);
} [/size] generates this output: [80: Mon 19-01-07 13:00] 1.14407/1.14474\1.14368/1.14394 -0.0 Enter Long EUR/USD Entry 0.0023498 at 13:00:00 (EUR/USD::L) Long 1@1.14629 Entry stop in tmf: 13:01:00, high = 1.14429, close = 1.14418 in tmf: 13:02:00, high = 1.14450, close = 1.14448 in tmf: 13:03:00, high = 1.14451, close = 1.14444 in tmf: 13:04:00, high = 1.14451, close = 1.14418 in tmf: 13:05:00, high = 1.14451, close = 1.14438 in tmf: 13:06:00, high = 1.14451, close = 1.14444 in tmf: 13:07:00, high = 1.14453, close = 1.14452 in tmf: 13:08:00, high = 1.14453, close = 1.14443 in tmf: 13:09:00, high = 1.14453, close = 1.14440 in tmf: 13:10:00, high = 1.14453, close = 1.14436 in tmf: 13:11:00, high = 1.14453, close = 1.14439 in tmf: 13:12:00, high = 1.14453, close = 1.14424 in tmf: 13:13:00, high = 1.14453, close = 1.14409 in tmf: 13:14:00, high = 1.14453, close = 1.14423 in tmf: 13:15:00, high = 1.14453, close = 1.14449 in tmf: 13:16:00, high = 1.14453, close = 1.14448 in tmf: 13:17:00, high = 1.14462, close = 1.14453 in tmf: 13:18:00, high = 1.14464, close = 1.14462 in tmf: 13:19:00, high = 1.14464, close = 1.14441 in tmf: 13:20:00, high = 1.14483, close = 1.14480 ---- long Entry Stop is hit!----open=1.14394, high=1.14483 close=1.14480 entStp=1.14473 [EUR/USD::L08101] Long 1@1.14441 x at 13:20:00 Com 0.0300 Mrg 37.74 Net 0 The correct entry price should be 1.14480.
|