How calculate price difference with adviseLong() in right way?

Posted By: madpower2000

How calculate price difference with adviseLong() in right way? - 11/23/16 19:35

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 picture demo.png
Posted By: boatman

Re: How calculate price difference with adviseLong() in right way? - 11/23/16 21:53

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.
Posted By: madpower2000

Re: How calculate price difference with adviseLong() in right way? - 11/26/16 15: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
© 2024 lite-C Forums