Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, howardR, 1 invisible), 777 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How calculate price difference with adviseLong() in right way? #463255
11/23/16 19:35
11/23/16 19:35
Joined: Apr 2016
Posts: 38
madpower2000 Offline OP
Newbie
madpower2000  Offline OP
Newbie

Joined: Apr 2016
Posts: 38
Hi
Can’t figure out, how adviseLong() calculate price difference
I run this code:

// Run the script in [Train] mode with asset EUR/USD selected
function run()
{
StartDate = 20140601; // just one day
EndDate = 20140602;
BarPeriod = 60; // use 1-hour bars

set(RULES); // generate signals
LifeTime = 1; // prediction horizon ONE bar
Spread = RollLong = RollShort = Commission = Slippage = 0;

adviseLong(SIGNALS,0, priceClose(), priceClose(1));
enterLong();
}

With LifeTime = 1, our target is the return of next bar trade. Trading costs are set to zero, so in this case the return is equivalent to the price difference just one bar in the future, right?
But after comparing price difference between reference bar and adviseLong() output – it’s not identical as supposed to be. (see attached compare table)

Attached Files
demo.png (17 downloads)
Last edited by madpower2000; 11/23/16 19:35.
Re: How calculate price difference with adviseLong() in right way? [Re: madpower2000] #463258
11/23/16 21:53
11/23/16 21:53
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline
Senior Member
boatman  Offline
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
It looks to me like there is non-zero slippage in the trade results reported from adviseLong(), even though you've set Slippage to zero. The difference could also arise from the trade results being affected by the exchange rate between your account currency and the quote currency of the asset being used.

Re: How calculate price difference with adviseLong() in right way? [Re: boatman] #463286
11/26/16 15:38
11/26/16 15:38
Joined: Apr 2016
Posts: 38
madpower2000 Offline OP
Newbie
madpower2000  Offline OP
Newbie

Joined: Apr 2016
Posts: 38
No, Kris, I can’t confirm your hypothesis about exchange rate influence. I change USD<->EUR in acounts.csv – result is the same.
So, waiting for jcl replay. confused


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1