Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,561 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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 | 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